Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_bot_on_quarterly_cup.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Regularly forecast new questions
name: Forecast on Quarterly Cup

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_bot_on_tournament.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Regularly forecast new questions
name: Forecast on new AI tournament questions

on:
workflow_dispatch:
Expand Down
22 changes: 15 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Q1TemplateBot(ForecastBot):
"""

_max_concurrent_questions = (
2 # Set this to whatever works for your search-provider/ai-model rate limits
10 # Set this to whatever works for your search-provider/ai-model rate limits
)
_concurrency_limiter = asyncio.Semaphore(_max_concurrent_questions)

Expand All @@ -74,26 +74,34 @@ async def run_research(self, question: MetaculusQuestion) -> str:
research = await self._call_exa_smart_searcher(question.question_text)
elif os.getenv("PERPLEXITY_API_KEY"):
research = await self._call_perplexity(question.question_text)
elif os.getenv("OPENROUTER_API_KEY"):
research = await self._call_perplexity(question.question_text, use_open_router=True)
else:
research = ""
logger.info(f"Found Research for {question.page_url}:\n{research}")
return research

async def _call_perplexity(self, question: str) -> str:
system_prompt = clean_indents(
"""
async def _call_perplexity(self, question: str, use_open_router: bool = False) -> str:
prompt = clean_indents(
f"""
You are an assistant to a superforecaster.
The superforecaster will give you a question they intend to forecast on.
To be a great assistant, you generate a concise but detailed rundown of the most relevant news, including if the question would resolve Yes or No based on current information.
You do not produce forecasts yourself.

Question:
{question}
"""
)
if use_open_router:
model_name = "openrouter/perplexity/sonar-reasoning"
else:
model_name = "perplexity/sonar-pro" # perplexity/sonar-reasoning and perplexity/sonar are cheaper, but do only 1 search.
model = GeneralLlm(
model="perplexity/sonar-pro", # perplexity/sonar is cheaper, but does only 1 search.
model=model_name,
temperature=0.1,
system_prompt=system_prompt,
)
response = await model.invoke(question)
response = await model.invoke(prompt)
return response

async def _call_exa_smart_searcher(self, question: str) -> str:
Expand Down