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
3 changes: 3 additions & 0 deletions demo/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"php-http/discovery": "^1.20",
"runtime/frankenphp-symfony": "^0.2.0",
"symfony/ai-bundle": "@dev",
"symfony/ai-clock-tool": "@dev",
"symfony/ai-similarity-search-tool": "@dev",
"symfony/ai-wikipedia-tool": "@dev",
"symfony/asset": "~7.3.0",
"symfony/asset-mapper": "~7.3.0",
"symfony/clock": "~7.3.0",
Expand Down
14 changes: 8 additions & 6 deletions demo/config/packages/ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ai:
platform: 'ai.platform.openai'
model: 'gpt-4o-mini'
tools:
- 'Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch'
- 'Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch'
- service: 'clock'
name: 'clock'
description: 'Provides the current date and time.'
Expand Down Expand Up @@ -40,7 +40,7 @@ ai:
text: 'Please answer the users question based on Wikipedia, only use information provided in the messages.'
include_tools: true
tools:
- 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia'
- 'Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia'
include_sources: true
speech:
platform: 'ai.platform.openai'
Expand All @@ -52,7 +52,7 @@ ai:
If you don't know the answer, say so. Keep in mind that you are in a spoken conversation, so keep your
answers concise and to the point. They will be read out loud to the user.
tools:
- 'Symfony\AI\Agent\Toolbox\Tool\Clock'
- 'Symfony\AI\Agent\Bridge\Clock\Clock'
# Agent in agent 🤯
- agent: 'blog'
name: 'symfony_blog'
Expand Down Expand Up @@ -106,9 +106,11 @@ services:
autowire: true
autoconfigure: true

Symfony\AI\Agent\Toolbox\Tool\Clock: ~
Symfony\AI\Agent\Toolbox\Tool\Wikipedia: ~
Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch:
# TODO: Remove once flex recipe works correctly
Symfony\AI\Agent\Bridge\Clock\Clock: ~
Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia: ~

Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch:
$vectorizer: '@ai.vectorizer.openai'
$store: '@ai.store.chroma_db.symfonycon'

Expand Down
18 changes: 11 additions & 7 deletions docs/bundles/ai-bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Advanced Example with Multiple Agents
include_tools: true # Include tool definitions at the end of the system prompt
tools:
# Referencing a service with #[AsTool] attribute
- 'Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch'
- 'Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch'

# Referencing a service without #[AsTool] attribute
- service: 'App\Agent\Tool\CompanyName'
Expand All @@ -91,7 +91,7 @@ Advanced Example with Multiple Agents
platform: 'ai.platform.anthropic'
model: 'claude-3-7-sonnet'
tools: # If undefined, all tools are injected into the agent, use "tools: false" to disable tools.
- 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia'
- 'Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia'
fault_tolerant_toolbox: false # Disables fault tolerant toolbox, default is true
search_agent:
platform: 'ai.platform.perplexity'
Expand Down Expand Up @@ -776,13 +776,18 @@ The following tools can be installed as dedicated packages, no configuration is
.. code-block:: terminal

$ composer require symfony/ai-brave-tool
$ composer require symfony/ai-clock-tool
$ composer require symfony/ai-firecrawl-tool
$ composer require symfony/ai-mapbox-tool
$ composer require symfony/ai-open-meteo-tool
$ composer require symfony/ai-scraper-tool
$ composer require symfony/ai-serp-api-tool
$ composer require symfony/ai-similarity-search-tool
$ composer require symfony/ai-tavily-tool
$ composer require symfony/ai-wikipedia-tool
$ composer require symfony/ai-youtube-tool

For tools not available as dedicated packages (those in the ``Toolbox\Tool`` namespace), register them manually as services:
Some tools may require additional configuration even when installed as dedicated packages. For example, the SimilaritySearch tool requires a vectorizer and store:

.. code-block:: yaml

Expand All @@ -791,10 +796,9 @@ For tools not available as dedicated packages (those in the ``Toolbox\Tool`` nam
autowire: true
autoconfigure: true

Symfony\AI\Agent\Toolbox\Tool\Clock: ~
Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch: ~
Symfony\AI\Agent\Toolbox\Tool\Wikipedia: ~
Symfony\AI\Agent\Toolbox\Tool\YouTubeTranscriber: ~
Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch:
$vectorizer: '@ai.vectorizer.openai'
$store: '@ai.store.main'

Creating Custom Tools
---------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/aimlapi/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\AiMlApi\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/anthropic/structured-output-clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Anthropic\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/anthropic/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Source\Source;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Anthropic\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/bedrock/toolcall-claude.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Bedrock\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/bedrock/toolcall-nova.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Bedrock\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
5 changes: 5 additions & 0 deletions examples/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
"symfony/ai-agent": "@dev",
"symfony/ai-brave-tool": "@dev",
"symfony/ai-chat": "@dev",
"symfony/ai-clock-tool": "@dev",
"symfony/ai-open-meteo-tool": "@dev",
"symfony/ai-scraper-tool": "@dev",
"symfony/ai-serp-api-tool": "@dev",
"symfony/ai-similarity-search-tool": "@dev",
"symfony/ai-platform": "@dev",
"symfony/ai-store": "@dev",
"symfony/ai-tavily-tool": "@dev",
"symfony/ai-wikipedia-tool": "@dev",
"symfony/ai-youtube-tool": "@dev",
"symfony/cache": "^7.3|^8.0",
"symfony/clock": "^7.3|^8.0",
"symfony/console": "^7.3|^8.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/deepseek/structured-output-clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\DeepSeek\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/deepseek/toolcall-stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\DeepSeek\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/deepseek/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\DeepSeek\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/dockermodelrunner/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\DockerModelRunner\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/gemini/server-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Gemini\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/gemini/structured-output-clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Gemini\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/gemini/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Gemini\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
4 changes: 2 additions & 2 deletions examples/mistral/toolcall-stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Youtube\YoutubeTranscriber;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\YouTubeTranscriber;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Mistral\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand All @@ -21,7 +21,7 @@

$platform = PlatformFactory::create(env('MISTRAL_API_KEY'), http_client());

$transcriber = new YouTubeTranscriber(http_client());
$transcriber = new YoutubeTranscriber(http_client());
$toolbox = new Toolbox([$transcriber], logger: logger());
$processor = new AgentProcessor($toolbox);
$agent = new Agent($platform, 'mistral-large-latest', [$processor], [$processor]);
Expand Down
2 changes: 1 addition & 1 deletion examples/mistral/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Mistral\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/ollama/rag.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Fixtures\Movies;
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory;
Expand Down
2 changes: 1 addition & 1 deletion examples/ollama/stream-toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/ollama/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/openai/agent-stream-sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Bridge\Tavily\Tavily;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/openai/structured-output-clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Clock\Clock;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Clock;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
2 changes: 1 addition & 1 deletion examples/openai/toolcall-stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\Wikipedia;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand Down
4 changes: 2 additions & 2 deletions examples/openai/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\Youtube\YoutubeTranscriber;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\YouTubeTranscriber;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
use Symfony\AI\Platform\Message\Message;
Expand All @@ -21,7 +21,7 @@

$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());

$transcriber = new YouTubeTranscriber(http_client());
$transcriber = new YoutubeTranscriber(http_client());
$toolbox = new Toolbox([$transcriber], logger: logger());
$processor = new AgentProcessor($toolbox);
$agent = new Agent($platform, 'gpt-4o-mini', [$processor], [$processor]);
Expand Down
2 changes: 1 addition & 1 deletion examples/rag/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Fixtures\Movies;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
Expand Down
2 changes: 1 addition & 1 deletion examples/rag/chromadb.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

use Codewithkyrian\ChromaDB\Factory;
use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Fixtures\Movies;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
Expand Down
2 changes: 1 addition & 1 deletion examples/rag/clickhouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Fixtures\Movies;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
Expand Down
2 changes: 1 addition & 1 deletion examples/rag/cloudflare.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

use Symfony\AI\Agent\Agent;
use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\AgentProcessor;
use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch;
use Symfony\AI\Agent\Toolbox\Toolbox;
use Symfony\AI\Fixtures\Movies;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
Expand Down
Loading