Skip to content

Commit 9108766

Browse files
CodexVeritasclaude
andcommitted
Merge computer-use into the agents extra and use Perplexity in the README
- Fold the computer-use extra into agents. ComputerUse needs openai-agents anyway, so a separate extra only made people install two things to get one feature. agents now carries hyperbrowser as well. - The README bot example now researches with GeneralLlm(model="perplexity/sonar-pro"), which takes a prompt. The previous AskNewsSearcher call was wrong for this example: its methods take a search query, not a composed research prompt. Verified a new bot maker's path end to end against a wheel installed into a clean venv outside the repo: `import forecasting_tools` pulls in none of the optional packages, the README example subclass defines and instantiates, every name the README references imports, gated names raise with an install command, and hasattr degrades to False. Installing [agents] then unlocks ComputerUse and the rest while front-end stays gated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent a77da4a commit 9108766

5 files changed

Lines changed: 33 additions & 37 deletions

File tree

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ from forecasting_tools import (
158158
ReasonedPrediction,
159159
PredictedOptionList,
160160
NumericDistribution,
161-
AskNewsSearcher,
162161
MetaculusClient,
163162
GeneralLlm,
164163
PredictionExtractor,
@@ -168,7 +167,7 @@ from forecasting_tools.util.misc import clean_indents
168167
class MyCustomBot(TemplateBot):
169168

170169
async def run_research(self, question: MetaculusQuestion) -> str:
171-
searcher = AskNewsSearcher()
170+
searcher = GeneralLlm(model="perplexity/sonar-pro", temperature=0)
172171

173172
prompt = clean_indents(
174173
f"""
@@ -183,7 +182,7 @@ class MyCustomBot(TemplateBot):
183182
"""
184183
)
185184

186-
report = await searcher.get_formatted_news_async(prompt)
185+
report = await searcher.invoke(prompt)
187186
return report
188187

189188
async def _run_forecast_on_binary(
@@ -511,14 +510,13 @@ Some features need heavier dependencies that a bot does not, so they are opt-in.
511510

512511
| Extra | You need it for |
513512
| --- | --- |
514-
| `agents` | Anything built on the agent SDK: `QuestionDecomposer`, `QuestionOperationalizer`, `TopicGenerator`, `DataAnalyzer`, `Benchmarker`, `BenchmarkForBot`, `BotOptimizer`, `CustomizableBot`, and the AI Congress tools |
513+
| `agents` | Anything built on the agent SDK: `QuestionDecomposer`, `QuestionOperationalizer`, `TopicGenerator`, `DataAnalyzer`, `Benchmarker`, `BenchmarkForBot`, `BotOptimizer`, `CustomizableBot`, `ComputerUse` (browser-driving agent), and the AI Congress tools |
515514
| `front-end` | The Streamlit app in `forecasting_tools/front_end/` and `run_benchmark_streamlit_page` |
516-
| `computer-use` | `ComputerUse` (browser-driving agent) |
517515
| `all` | Everything above |
518516

519517
```bash
520518
pip install 'forecasting-tools[agents]'
521-
pip install 'forecasting-tools[front-end,computer-use]'
519+
pip install 'forecasting-tools[agents,front-end]'
522520
pip install 'forecasting-tools[all]'
523521
```
524522

code_tests/unit_tests/test_optional_imports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_gated_names_say_which_extra_to_install() -> None:
6565
"BotOptimizer": "agents",
6666
"DataAnalyzer": "agents",
6767
"QuestionDecomposer": "agents",
68-
"ComputerUse": "computer-use",
68+
"ComputerUse": "agents",
6969
"run_benchmark_streamlit_page": "front-end",
7070
}
7171
for name, extra in extra_for_name.items():

forecasting_tools/agents_and_tools/research/computer_use.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from forecasting_tools.util.misc import clean_indents
88
from forecasting_tools.util.optional_imports import require_optional_package
99

10-
require_optional_package("hyperbrowser", "hyperbrowser", "computer-use")
11-
require_optional_package("agents", "openai-agents", "computer-use")
10+
require_optional_package("hyperbrowser", "hyperbrowser", "agents")
11+
require_optional_package("agents", "openai-agents", "agents")
1212

1313
from hyperbrowser import AsyncHyperbrowser # noqa: E402
1414
from hyperbrowser.models import ( # noqa: E402

poetry.lock

Lines changed: 25 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ cloakbrowser = {version = ">=0.3.31,<0.4.0", optional = true}
7070
source-archive = ["boto3", "playwright", "firecrawl-py", "trafilatura", "pymupdf4llm", "cloakbrowser", "hyperbrowser"]
7171
# The template bot and the bot running infrastructure need none of the below, so
7272
# they are opt-in and the base install stays small. See "Optional extras" in the README.
73-
agents = ["openai-agents"]
74-
computer-use = ["hyperbrowser", "openai-agents"]
73+
agents = ["openai-agents", "hyperbrowser"]
7574
front-end = ["streamlit", "openai-agents"]
7675
all = ["openai-agents", "hyperbrowser", "streamlit", "boto3", "playwright", "firecrawl-py", "trafilatura", "pymupdf4llm", "cloakbrowser"]
7776

0 commit comments

Comments
 (0)