diff --git a/evo_researcher/autonolas/research.py b/evo_researcher/autonolas/research.py index d2a84cc7..e389b4c3 100644 --- a/evo_researcher/autonolas/research.py +++ b/evo_researcher/autonolas/research.py @@ -1076,11 +1076,11 @@ def fetch_additional_information( research_chain = ( research_prompt | ChatOpenAI( - model_name=engine, + model=engine, temperature=temperature, max_tokens=max_compl_tokens, n=1, - request_timeout=120, + timeout=120, ) | StrOutputParser() ) @@ -1175,7 +1175,7 @@ def make_prediction( prediction_prompt = ChatPromptTemplate.from_template(template=PREDICTION_PROMPT) - llm = ChatOpenAI(model_name=engine, temperature=temperature) + llm = ChatOpenAI(model=engine, temperature=temperature) formatted_messages = prediction_prompt.format_messages(user_prompt=prompt, additional_information=additional_information, timestamp=formatted_time_utc) generation = llm.generate([formatted_messages], logprobs=True, top_logprobs=5) diff --git a/evo_researcher/benchmark/utils.py b/evo_researcher/benchmark/utils.py index eef458fa..93edf21f 100644 --- a/evo_researcher/benchmark/utils.py +++ b/evo_researcher/benchmark/utils.py @@ -18,8 +18,8 @@ class Market(BaseModel): p_yes: float volume: float is_resolved: bool - resolution: str | None - outcomePrices: list[float] | None + resolution: str | None = None + outcomePrices: list[float] | None = None @validator("outcomePrices", pre=True) def _validate_outcome_prices(cls, value: list[float] | None) -> list[float] | None: @@ -55,8 +55,8 @@ def binary_answer(self) -> bool: class Prediction(BaseModel): - evaluation: t.Optional[EvalautedQuestion] - outcome_prediction: t.Optional[OutcomePrediction] + evaluation: t.Optional[EvalautedQuestion] = None + outcome_prediction: t.Optional[OutcomePrediction] = None time: t.Optional[float] = None cost: t.Optional[float] = None diff --git a/evo_researcher/functions/evaluate_question.py b/evo_researcher/functions/evaluate_question.py index ac3246e6..b3025280 100644 --- a/evo_researcher/functions/evaluate_question.py +++ b/evo_researcher/functions/evaluate_question.py @@ -38,7 +38,7 @@ def evaluate_question( """ Evaluate if the question is actually answerable. """ - llm = ChatOpenAI(model_name=engine, temperature=0.0) + llm = ChatOpenAI(model=engine, temperature=0.0) prompt = ChatPromptTemplate.from_template(template=prompt_template) messages = prompt.format_messages(question=question) diff --git a/evo_researcher/functions/generate_subqueries.py b/evo_researcher/functions/generate_subqueries.py index fc8f2786..94f43462 100644 --- a/evo_researcher/functions/generate_subqueries.py +++ b/evo_researcher/functions/generate_subqueries.py @@ -15,7 +15,7 @@ def generate_subqueries(query: str, limit: int) -> list[str]: subquery_generation_chain = ( subquery_generation_prompt | - ChatOpenAI(model_name="gpt-4-1106-preview") | + ChatOpenAI(model="gpt-4-1106-preview") | CommaSeparatedListOutputParser() ) diff --git a/evo_researcher/functions/grade_info.py b/evo_researcher/functions/grade_info.py index 2f54a7d0..573e75d0 100644 --- a/evo_researcher/functions/grade_info.py +++ b/evo_researcher/functions/grade_info.py @@ -70,7 +70,7 @@ def grade_info(question: str, information: str) -> str: planning_prompt = ChatPromptTemplate.from_template(template=grading_planning_prompt_template) formatting_prompt = ChatPromptTemplate.from_template(template=grading_format_prompt_template) - llm = ChatOpenAI(model_name="gpt-4-1106-preview", temperature=0) + llm = ChatOpenAI(model="gpt-4-1106-preview", temperature=0) planning_chain = ( planning_prompt | diff --git a/evo_researcher/functions/prepare_report.py b/evo_researcher/functions/prepare_report.py index a50ce911..58a8d55f 100644 --- a/evo_researcher/functions/prepare_report.py +++ b/evo_researcher/functions/prepare_report.py @@ -22,7 +22,7 @@ def prepare_summary(goal: str, content: str, model: str, trim_content_to_tokens: research_evaluation_chain = ( evaluation_prompt | - ChatOpenAI(model_name=model) | + ChatOpenAI(model=model) | StrOutputParser() ) @@ -60,7 +60,7 @@ def prepare_report(goal: str, scraped: list[str], model: str) -> str: research_evaluation_chain = ( evaluation_prompt | - ChatOpenAI(model_name=model) | + ChatOpenAI(model=model) | StrOutputParser() ) diff --git a/evo_researcher/functions/rephrase_question.py b/evo_researcher/functions/rephrase_question.py index 4bb6af84..357cce44 100644 --- a/evo_researcher/functions/rephrase_question.py +++ b/evo_researcher/functions/rephrase_question.py @@ -35,7 +35,7 @@ def rephrase_question( open_ended_question: What is the color of the sky? """ tokenizer = tiktoken.encoding_for_model(engine) - llm = ChatOpenAI(model_name=engine, temperature=0.0) + llm = ChatOpenAI(model=engine, temperature=0.0) prompt = ChatPromptTemplate.from_template(template=QUESTION_REPHRASE_PROMPT) messages = prompt.format_messages(question=question) diff --git a/evo_researcher/functions/rerank_results.py b/evo_researcher/functions/rerank_results.py index a7ac5bdc..8bfde4df 100644 --- a/evo_researcher/functions/rerank_results.py +++ b/evo_researcher/functions/rerank_results.py @@ -19,7 +19,7 @@ def rerank_results(results: list[str], goal: str) -> list[str]: rerank_results_chain = ( rerank_results_prompt | - ChatOpenAI(model_name="gpt-4-1106-preview") | + ChatOpenAI(model="gpt-4-1106-preview") | CommaSeparatedListOutputParser() ) diff --git a/evo_researcher/functions/rerank_subqueries.py b/evo_researcher/functions/rerank_subqueries.py index 10a485a8..d983ba07 100644 --- a/evo_researcher/functions/rerank_subqueries.py +++ b/evo_researcher/functions/rerank_subqueries.py @@ -17,7 +17,7 @@ def rerank_subqueries(queries: list[str], goal: str) -> list[str]: rerank_results_chain = ( rerank_results_prompt | - ChatOpenAI(model_name="gpt-4-1106-preview") | + ChatOpenAI(model="gpt-4-1106-preview") | StrOutputParser() ) diff --git a/evo_researcher/functions/summarize.py b/evo_researcher/functions/summarize.py index 98adfd9b..a0979ea9 100644 --- a/evo_researcher/functions/summarize.py +++ b/evo_researcher/functions/summarize.py @@ -7,7 +7,7 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter def summarize(objective: str, content: str) -> str: - llm = ChatOpenAI(temperature = 0, model_name = "gpt-3.5-turbo-16k-0613") + llm = ChatOpenAI(temperature = 0, model="gpt-3.5-turbo-16k-0613") map_template = """ The following is a set of documents