Skip to content

Commit

Permalink
More prints to debug known outcome agent
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii committed Mar 25, 2024
1 parent 14153e8 commit bc6b37f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions prediction_market_agent/agents/known_outcome_agent/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@ def pick_markets(self, markets: list[AgentMarket]) -> list[AgentMarket]:
# been correctly bet on, and therefore the value of betting on them
# is low.
if not market_is_saturated(market=market):
print(f"Checking market {market.id=} {market.question=}")
answer = get_known_outcome(
model=self.model,
question=market.question,
max_tries=3,
)
if answer.has_known_outcome():
print(
f"Picking market {market.id=} {market.question=} with answer {answer.result=}"
)
picked_markets.append(market)
self.markets_with_known_outcomes[market.id] = answer.result

else:
print(
f"Skipping market {market.id=} {market.question=}, because it is already saturated."
)

return picked_markets

def answer_binary_market(self, market: AgentMarket) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def get_known_outcome(model: str, question: str, max_tries: int) -> Answer:
search_prompt = ChatPromptTemplate.from_template(
template=GENERATE_SEARCH_QUERY_PROMPT
).format_messages(date_str=date_str, question=question)
print(f"Invoking LLM for {search_prompt=}")
search_query = str(llm.invoke(search_prompt).content).strip('"')
print(f"Searchig for {search_query=}")
search_results = web_search(query=search_query, max_results=5)
if not search_results:
raise ValueError("No search results found.")
Expand Down

0 comments on commit bc6b37f

Please sign in to comment.