diff --git a/.github/workflows/run_bot_on_quarterly_cup.yaml b/.github/workflows/run_bot_on_quarterly_cup.yaml index a15dc0e78..c059e959c 100644 --- a/.github/workflows/run_bot_on_quarterly_cup.yaml +++ b/.github/workflows/run_bot_on_quarterly_cup.yaml @@ -1,4 +1,4 @@ -name: Regularly forecast new questions +name: Forecast on Quarterly Cup on: workflow_dispatch: diff --git a/.github/workflows/run_bot_on_tournament.yaml b/.github/workflows/run_bot_on_tournament.yaml index bff478dbd..8386d0d78 100644 --- a/.github/workflows/run_bot_on_tournament.yaml +++ b/.github/workflows/run_bot_on_tournament.yaml @@ -1,4 +1,4 @@ -name: Regularly forecast new questions +name: Forecast on new AI tournament questions on: workflow_dispatch: diff --git a/main.py b/main.py index f24458663..2dcb940d0 100644 --- a/main.py +++ b/main.py @@ -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) @@ -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: