mirror of
https://github.com/assafelovic/gpt-researcher.git
synced 2024-04-09 14:09:35 +03:00
added ability to select iterations of research steps
This commit is contained in:
@@ -22,7 +22,7 @@ class Config:
|
||||
self.memory_backend = "local"
|
||||
self.total_words = 1000
|
||||
self.report_format = "apa"
|
||||
self.max_iterations = 1
|
||||
self.max_iterations = 3
|
||||
|
||||
self.load_config_file()
|
||||
|
||||
|
||||
@@ -76,11 +76,12 @@ async def get_sub_queries(query, agent_role_prompt, cfg):
|
||||
sub_queries: List of sub queries
|
||||
|
||||
"""
|
||||
max_research_iterations = cfg.max_iterations if cfg.max_iterations else 1
|
||||
response = await create_chat_completion(
|
||||
model=cfg.smart_llm_model,
|
||||
messages=[
|
||||
{"role": "system", "content": f"{agent_role_prompt}"},
|
||||
{"role": "user", "content": generate_search_queries_prompt(query)}],
|
||||
{"role": "user", "content": generate_search_queries_prompt(query, max_iterations=max_research_iterations)}],
|
||||
temperature=0,
|
||||
llm_provider=cfg.llm_provider
|
||||
)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def generate_search_queries_prompt(question):
|
||||
def generate_search_queries_prompt(question, max_iterations=3):
|
||||
""" Generates the search queries prompt for the given question.
|
||||
Args: question (str): The question to generate the search queries prompt for
|
||||
Returns: str: The search queries prompt for the given question
|
||||
"""
|
||||
|
||||
return f'Write 3 google search queries to search online that form an objective opinion from the following: "{question}"' \
|
||||
return f'Write {max_iterations} google search queries to search online that form an objective opinion from the following: "{question}"' \
|
||||
f'Use the current date if needed: {datetime.now().strftime("%B %d, %Y")}.\n' \
|
||||
f'You must respond with a list of strings in the following format: ["query 1", "query 2", "query 3"].'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user