Set research type dynamically via environment variable
Added `RESEARCH_TYPE` environment variable to configure the default research type for GPTResearcher. Updated the initialization of GPTResearcher to use this dynamic configuration, improving flexibility and adaptability.
This commit is contained in:
parent
626345b65e
commit
7e5a6db0f6
1 changed files with 3 additions and 2 deletions
|
@ -37,6 +37,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
# Initialize FastMCP server
|
||||
mcp = FastMCP("GPT Researcher")
|
||||
research_type = os.getenv("RESEARCH_TYPE", "deep")
|
||||
|
||||
# Initialize researchers dictionary
|
||||
if not hasattr(mcp, "researchers"):
|
||||
|
@ -65,7 +66,7 @@ async def research_resource(topic: str) -> str:
|
|||
logger.info(f"Conducting new research for resource on topic: {topic}")
|
||||
|
||||
# Initialize GPT Researcher
|
||||
researcher = GPTResearcher(topic)
|
||||
researcher = GPTResearcher(topic, report_type=research_type)
|
||||
|
||||
try:
|
||||
# Conduct the research
|
||||
|
@ -107,7 +108,7 @@ async def deep_research(query: str) -> Dict[str, Any]:
|
|||
research_id = str(uuid.uuid4())
|
||||
|
||||
# Initialize GPT Researcher
|
||||
researcher = GPTResearcher(query, report_type="deep")
|
||||
researcher = GPTResearcher(query, report_type=research_type)
|
||||
|
||||
# Start research
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue