Skip to content

Commit d2df16e

Browse files
committed
minor #162 [Agent][Examples] Remove Toolbox::create(...) (chr-hertel)
This PR was merged into the main branch. Discussion ---------- [Agent][Examples] Remove Toolbox::create(...) | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | | License | MIT This is just not useful other than in simplified examples - and not even there, see #160 Commits ------- 5746ca6 Remove Toolbox::create(...)
2 parents 24797e3 + 5746ca6 commit d2df16e

26 files changed

+31
-37
lines changed

examples/anthropic/toolcall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$model = new Claude();
3333

3434
$wikipedia = new Wikipedia(HttpClient::create());
35-
$toolbox = Toolbox::create($wikipedia);
35+
$toolbox = new Toolbox([$wikipedia]);
3636
$processor = new AgentProcessor($toolbox);
3737
$agent = new Agent($platform, $model, [$processor], [$processor]);
3838

examples/bedrock/toolcall-claude.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$model = new Claude('claude-3-7-sonnet-20250219');
3434

3535
$wikipedia = new Wikipedia(HttpClient::create());
36-
$toolbox = Toolbox::create($wikipedia);
36+
$toolbox = new Toolbox([$wikipedia]);
3737
$processor = new AgentProcessor($toolbox);
3838
$agent = new Agent($platform, $model, [$processor], [$processor]);
3939

examples/bedrock/toolcall-nova.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$model = new Nova();
3434

3535
$wikipedia = new Wikipedia(HttpClient::create());
36-
$toolbox = Toolbox::create($wikipedia);
36+
$toolbox = new Toolbox([$wikipedia]);
3737
$processor = new AgentProcessor($toolbox);
3838
$agent = new Agent($platform, $model, [$processor], [$processor]);
3939

examples/google/server-tools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// Available server-side tools as of 2025-06-28: url_context, google_search, code_execution
3333
$llm = new Gemini('gemini-2.5-pro-preview-03-25', ['server_tools' => ['url_context' => true], 'temperature' => 1.0]);
3434

35-
$toolbox = Toolbox::create(new Clock());
35+
$toolbox = new Toolbox([new Clock()]);
3636
$processor = new AgentProcessor($toolbox);
3737
$agent = new Agent($platform, $llm);
3838

examples/google/structured-output-clock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);
3434

3535
$clock = new Clock(new SymfonyClock());
36-
$toolbox = Toolbox::create($clock);
36+
$toolbox = new Toolbox([$clock]);
3737
$toolProcessor = new ToolProcessor($toolbox);
3838
$structuredOutputProcessor = new StructuredOutputProcessor();
3939
$agent = new Agent($platform, $model, [$toolProcessor, $structuredOutputProcessor], [$toolProcessor, $structuredOutputProcessor]);

examples/google/toolcall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$platform = PlatformFactory::create($_SERVER['GEMINI_API_KEY']);
3131
$llm = new Gemini(Gemini::GEMINI_2_FLASH);
3232

33-
$toolbox = Toolbox::create(new Clock());
33+
$toolbox = new Toolbox([new Clock()]);
3434
$processor = new AgentProcessor($toolbox);
3535
$agent = new Agent($platform, $llm, [$processor], [$processor]);
3636

examples/mistral/toolcall-stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$model = new Mistral();
3333

3434
$transcriber = new YouTubeTranscriber(HttpClient::create());
35-
$toolbox = Toolbox::create($transcriber);
35+
$toolbox = new Toolbox([$transcriber]);
3636
$processor = new AgentProcessor($toolbox);
3737
$agent = new Agent($platform, $model, [$processor], [$processor]);
3838

examples/mistral/toolcall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$platform = PlatformFactory::create($_SERVER['MISTRAL_API_KEY']);
3131
$model = new Mistral();
3232

33-
$toolbox = Toolbox::create(new Clock());
33+
$toolbox = new Toolbox([new Clock()]);
3434
$processor = new AgentProcessor($toolbox);
3535
$agent = new Agent($platform, $model, [$processor], [$processor]);
3636

examples/openai/structured-output-clock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$model = new GPT(GPT::GPT_4O_MINI);
3434

3535
$clock = new Clock(new SymfonyClock());
36-
$toolbox = Toolbox::create($clock);
36+
$toolbox = new Toolbox([$clock]);
3737
$toolProcessor = new ToolProcessor($toolbox);
3838
$structuredOutputProcessor = new StructuredOutputProcessor();
3939
$agent = new Agent($platform, $model, [$toolProcessor, $structuredOutputProcessor], [$toolProcessor, $structuredOutputProcessor]);

examples/openai/toolcall-stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$model = new GPT(GPT::GPT_4O_MINI);
3333

3434
$wikipedia = new Wikipedia(HttpClient::create());
35-
$toolbox = Toolbox::create($wikipedia);
35+
$toolbox = new Toolbox([$wikipedia]);
3636
$processor = new AgentProcessor($toolbox);
3737
$agent = new Agent($platform, $model, [$processor], [$processor]);
3838
$messages = new MessageBag(Message::ofUser(<<<TXT

0 commit comments

Comments
 (0)