Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii committed Feb 13, 2024
1 parent 98845e6 commit b3da36e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions evo_researcher/autonolas/research.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions evo_researcher/benchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/evaluate_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/generate_subqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/grade_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions evo_researcher/functions/prepare_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down Expand Up @@ -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()
)

Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/rephrase_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/rerank_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/rerank_subqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down
2 changes: 1 addition & 1 deletion evo_researcher/functions/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3da36e

Please sign in to comment.