diff --git a/demo/composer.json b/demo/composer.json index ea319937b..0bba34031 100644 --- a/demo/composer.json +++ b/demo/composer.json @@ -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", diff --git a/demo/config/packages/ai.yaml b/demo/config/packages/ai.yaml index c716f7c46..96fe2af69 100644 --- a/demo/config/packages/ai.yaml +++ b/demo/config/packages/ai.yaml @@ -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.' @@ -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' @@ -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' @@ -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' diff --git a/docs/bundles/ai-bundle.rst b/docs/bundles/ai-bundle.rst index bbc642097..a0b959442 100644 --- a/docs/bundles/ai-bundle.rst +++ b/docs/bundles/ai-bundle.rst @@ -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' @@ -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' @@ -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 @@ -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 --------------------- diff --git a/examples/aimlapi/toolcall.php b/examples/aimlapi/toolcall.php index 26709108f..a32542778 100644 --- a/examples/aimlapi/toolcall.php +++ b/examples/aimlapi/toolcall.php @@ -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; diff --git a/examples/anthropic/structured-output-clock.php b/examples/anthropic/structured-output-clock.php index af1b9e131..b76b8308d 100644 --- a/examples/anthropic/structured-output-clock.php +++ b/examples/anthropic/structured-output-clock.php @@ -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; diff --git a/examples/anthropic/toolcall.php b/examples/anthropic/toolcall.php index ab494907f..18a8b5597 100644 --- a/examples/anthropic/toolcall.php +++ b/examples/anthropic/toolcall.php @@ -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; diff --git a/examples/bedrock/toolcall-claude.php b/examples/bedrock/toolcall-claude.php index 6370c2858..ce3c18176 100644 --- a/examples/bedrock/toolcall-claude.php +++ b/examples/bedrock/toolcall-claude.php @@ -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; diff --git a/examples/bedrock/toolcall-nova.php b/examples/bedrock/toolcall-nova.php index 67f375cfa..a1cdcda9c 100644 --- a/examples/bedrock/toolcall-nova.php +++ b/examples/bedrock/toolcall-nova.php @@ -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; diff --git a/examples/composer.json b/examples/composer.json index 53a153f13..2ccbcaa19 100644 --- a/examples/composer.json +++ b/examples/composer.json @@ -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", diff --git a/examples/deepseek/structured-output-clock.php b/examples/deepseek/structured-output-clock.php index b80626a91..b6265148d 100644 --- a/examples/deepseek/structured-output-clock.php +++ b/examples/deepseek/structured-output-clock.php @@ -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; diff --git a/examples/deepseek/toolcall-stream.php b/examples/deepseek/toolcall-stream.php index f404a6e22..0f40c8b92 100644 --- a/examples/deepseek/toolcall-stream.php +++ b/examples/deepseek/toolcall-stream.php @@ -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; diff --git a/examples/deepseek/toolcall.php b/examples/deepseek/toolcall.php index 767edf7ae..0a4073f64 100644 --- a/examples/deepseek/toolcall.php +++ b/examples/deepseek/toolcall.php @@ -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; diff --git a/examples/dockermodelrunner/toolcall.php b/examples/dockermodelrunner/toolcall.php index 73b55b379..3168364f3 100644 --- a/examples/dockermodelrunner/toolcall.php +++ b/examples/dockermodelrunner/toolcall.php @@ -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; diff --git a/examples/gemini/server-tools.php b/examples/gemini/server-tools.php index a51b194e9..fe916cb24 100644 --- a/examples/gemini/server-tools.php +++ b/examples/gemini/server-tools.php @@ -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; diff --git a/examples/gemini/structured-output-clock.php b/examples/gemini/structured-output-clock.php index 443feca00..830faa4f1 100644 --- a/examples/gemini/structured-output-clock.php +++ b/examples/gemini/structured-output-clock.php @@ -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; diff --git a/examples/gemini/toolcall.php b/examples/gemini/toolcall.php index 368c632d8..917578e64 100644 --- a/examples/gemini/toolcall.php +++ b/examples/gemini/toolcall.php @@ -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; diff --git a/examples/mistral/toolcall-stream.php b/examples/mistral/toolcall-stream.php index 2ae6c4660..d449e65b9 100644 --- a/examples/mistral/toolcall-stream.php +++ b/examples/mistral/toolcall-stream.php @@ -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; @@ -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]); diff --git a/examples/mistral/toolcall.php b/examples/mistral/toolcall.php index 13b1a2a38..ff8d3a3d4 100644 --- a/examples/mistral/toolcall.php +++ b/examples/mistral/toolcall.php @@ -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; diff --git a/examples/ollama/rag.php b/examples/ollama/rag.php index df6990618..1946d291e 100644 --- a/examples/ollama/rag.php +++ b/examples/ollama/rag.php @@ -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; diff --git a/examples/ollama/stream-toolcall.php b/examples/ollama/stream-toolcall.php index da709829c..d32298930 100644 --- a/examples/ollama/stream-toolcall.php +++ b/examples/ollama/stream-toolcall.php @@ -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; diff --git a/examples/ollama/toolcall.php b/examples/ollama/toolcall.php index 4b24c6d6a..32483f4c3 100644 --- a/examples/ollama/toolcall.php +++ b/examples/ollama/toolcall.php @@ -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; diff --git a/examples/openai/agent-stream-sources.php b/examples/openai/agent-stream-sources.php index 00610bd1d..0aeab8f19 100644 --- a/examples/openai/agent-stream-sources.php +++ b/examples/openai/agent-stream-sources.php @@ -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; diff --git a/examples/openai/structured-output-clock.php b/examples/openai/structured-output-clock.php index 2da321377..48058c5e8 100644 --- a/examples/openai/structured-output-clock.php +++ b/examples/openai/structured-output-clock.php @@ -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; diff --git a/examples/openai/toolcall-stream.php b/examples/openai/toolcall-stream.php index 03ca4657d..f7c21f6d6 100644 --- a/examples/openai/toolcall-stream.php +++ b/examples/openai/toolcall-stream.php @@ -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; diff --git a/examples/openai/toolcall.php b/examples/openai/toolcall.php index 1ea7d3359..6a14fdeff 100644 --- a/examples/openai/toolcall.php +++ b/examples/openai/toolcall.php @@ -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; @@ -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]); diff --git a/examples/rag/cache.php b/examples/rag/cache.php index 849931e7f..a48aaada3 100644 --- a/examples/rag/cache.php +++ b/examples/rag/cache.php @@ -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; diff --git a/examples/rag/chromadb.php b/examples/rag/chromadb.php index 5272a29e0..ebdb684d0 100644 --- a/examples/rag/chromadb.php +++ b/examples/rag/chromadb.php @@ -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; diff --git a/examples/rag/clickhouse.php b/examples/rag/clickhouse.php index 70d7891cc..52d9c8f2e 100644 --- a/examples/rag/clickhouse.php +++ b/examples/rag/clickhouse.php @@ -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; diff --git a/examples/rag/cloudflare.php b/examples/rag/cloudflare.php index 83dfbab22..f51e76637 100644 --- a/examples/rag/cloudflare.php +++ b/examples/rag/cloudflare.php @@ -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; diff --git a/examples/rag/in-memory.php b/examples/rag/in-memory.php index 47f9e4b06..edc75a997 100644 --- a/examples/rag/in-memory.php +++ b/examples/rag/in-memory.php @@ -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; diff --git a/examples/rag/manticore.php b/examples/rag/manticore.php index 4a6788961..481424a4b 100644 --- a/examples/rag/manticore.php +++ b/examples/rag/manticore.php @@ -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; diff --git a/examples/rag/mariadb-gemini.php b/examples/rag/mariadb-gemini.php index 3d6bf0d52..2c44feb98 100644 --- a/examples/rag/mariadb-gemini.php +++ b/examples/rag/mariadb-gemini.php @@ -12,8 +12,8 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Tools\DsnParser; 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\Gemini\PlatformFactory; diff --git a/examples/rag/mariadb-openai.php b/examples/rag/mariadb-openai.php index 4eab37093..b616958a9 100644 --- a/examples/rag/mariadb-openai.php +++ b/examples/rag/mariadb-openai.php @@ -12,8 +12,8 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Tools\DsnParser; 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; diff --git a/examples/rag/meilisearch.php b/examples/rag/meilisearch.php index 364317651..e5ce5742e 100644 --- a/examples/rag/meilisearch.php +++ b/examples/rag/meilisearch.php @@ -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; diff --git a/examples/rag/milvus.php b/examples/rag/milvus.php index 61404d597..1f8411bf8 100644 --- a/examples/rag/milvus.php +++ b/examples/rag/milvus.php @@ -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; diff --git a/examples/rag/mongodb.php b/examples/rag/mongodb.php index 23dc60e26..589f38838 100644 --- a/examples/rag/mongodb.php +++ b/examples/rag/mongodb.php @@ -11,8 +11,8 @@ use MongoDB\Client as MongoDbClient; 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; diff --git a/examples/rag/neo4j.php b/examples/rag/neo4j.php index 62b3d692b..8a109fbfe 100644 --- a/examples/rag/neo4j.php +++ b/examples/rag/neo4j.php @@ -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; diff --git a/examples/rag/pinecone.php b/examples/rag/pinecone.php index 1c352f4d6..072dd6b96 100644 --- a/examples/rag/pinecone.php +++ b/examples/rag/pinecone.php @@ -11,8 +11,8 @@ use Probots\Pinecone\Pinecone; 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; diff --git a/examples/rag/postgres.php b/examples/rag/postgres.php index 2e735c543..5a9dc126a 100644 --- a/examples/rag/postgres.php +++ b/examples/rag/postgres.php @@ -12,8 +12,8 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Tools\DsnParser; 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; diff --git a/examples/rag/qdrant.php b/examples/rag/qdrant.php index e447a09e5..7a142ca53 100644 --- a/examples/rag/qdrant.php +++ b/examples/rag/qdrant.php @@ -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; diff --git a/examples/rag/redis.php b/examples/rag/redis.php index c5f4973ce..eb682a4ff 100644 --- a/examples/rag/redis.php +++ b/examples/rag/redis.php @@ -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; diff --git a/examples/rag/supabase.php b/examples/rag/supabase.php index 0d756849c..c7cdfca64 100644 --- a/examples/rag/supabase.php +++ b/examples/rag/supabase.php @@ -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; diff --git a/examples/rag/surrealdb.php b/examples/rag/surrealdb.php index bd52c95e5..4a99a39c0 100644 --- a/examples/rag/surrealdb.php +++ b/examples/rag/surrealdb.php @@ -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; diff --git a/examples/rag/typesense.php b/examples/rag/typesense.php index 5882d57eb..bd2128d02 100644 --- a/examples/rag/typesense.php +++ b/examples/rag/typesense.php @@ -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; diff --git a/examples/rag/weaviate.php b/examples/rag/weaviate.php index ceb6ff874..15e14c46f 100644 --- a/examples/rag/weaviate.php +++ b/examples/rag/weaviate.php @@ -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\Embeddings; diff --git a/examples/scaleway/toolcall-stream.php b/examples/scaleway/toolcall-stream.php index 5a02b902c..836d7563c 100644 --- a/examples/scaleway/toolcall-stream.php +++ b/examples/scaleway/toolcall-stream.php @@ -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\Scaleway\PlatformFactory; use Symfony\AI\Platform\Message\Message; @@ -21,7 +21,7 @@ $platform = PlatformFactory::create(env('SCALEWAY_SECRET_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-oss-120b', [$processor], [$processor]); diff --git a/examples/scaleway/toolcall.php b/examples/scaleway/toolcall.php index e11c4837b..2dda183c8 100644 --- a/examples/scaleway/toolcall.php +++ b/examples/scaleway/toolcall.php @@ -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\Scaleway\PlatformFactory; use Symfony\AI\Platform\Message\Message; @@ -21,7 +21,7 @@ $platform = PlatformFactory::create(env('SCALEWAY_SECRET_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-oss-120b', [$processor], [$processor]); diff --git a/examples/toolbox/brave.php b/examples/toolbox/brave.php index 60d6577eb..c87c98370 100644 --- a/examples/toolbox/brave.php +++ b/examples/toolbox/brave.php @@ -11,9 +11,9 @@ use Symfony\AI\Agent\Agent; use Symfony\AI\Agent\Bridge\Brave\Brave; +use Symfony\AI\Agent\Bridge\Clock\Clock; +use Symfony\AI\Agent\Bridge\Scraper\Scraper; use Symfony\AI\Agent\Toolbox\AgentProcessor; -use Symfony\AI\Agent\Toolbox\Tool\Clock; -use Symfony\AI\Agent\Toolbox\Tool\Scraper; use Symfony\AI\Agent\Toolbox\Toolbox; use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/examples/toolbox/serpapi.php b/examples/toolbox/serpapi.php index 6b822a051..263e2c634 100644 --- a/examples/toolbox/serpapi.php +++ b/examples/toolbox/serpapi.php @@ -10,10 +10,10 @@ */ use Symfony\AI\Agent\Agent; +use Symfony\AI\Agent\Bridge\Clock\Clock; +use Symfony\AI\Agent\Bridge\Scraper\Scraper; use Symfony\AI\Agent\Bridge\SerpApi\SerpApi; use Symfony\AI\Agent\Toolbox\AgentProcessor; -use Symfony\AI\Agent\Toolbox\Tool\Clock; -use Symfony\AI\Agent\Toolbox\Tool\Scraper; use Symfony\AI\Agent\Toolbox\Toolbox; use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/examples/toolbox/tavily.php b/examples/toolbox/tavily.php index 115ab40b1..ed9044f01 100644 --- a/examples/toolbox/tavily.php +++ b/examples/toolbox/tavily.php @@ -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; diff --git a/examples/vertexai/structured-output-clock.php b/examples/vertexai/structured-output-clock.php index b832b4e57..683127c79 100644 --- a/examples/vertexai/structured-output-clock.php +++ b/examples/vertexai/structured-output-clock.php @@ -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\VertexAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/examples/vertexai/toolcall.php b/examples/vertexai/toolcall.php index 09cb98167..7fe5c788a 100644 --- a/examples/vertexai/toolcall.php +++ b/examples/vertexai/toolcall.php @@ -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\VertexAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/src/agent/composer.json b/src/agent/composer.json index 2f0ef5898..490c31260 100644 --- a/src/agent/composer.json +++ b/src/agent/composer.json @@ -33,17 +33,11 @@ "symfony/type-info": "^7.3|^8.0" }, "require-dev": { - "masterminds/html5": "^2.8", - "mrmysql/youtube-transcript": "^0.0.5", - "nyholm/psr7": "^1.8", - "php-http/discovery": "^1.19", "phpstan/phpstan": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^11.5.13", "symfony/ai-store": "@dev", "symfony/cache": "^7.3|^8.0", - "symfony/css-selector": "^7.3|^8.0", - "symfony/dom-crawler": "^7.3|^8.0", "symfony/event-dispatcher": "^7.3|^8.0", "symfony/http-foundation": "^7.3|^8.0", "symfony/translation": "^7.3|^8.0", diff --git a/src/agent/src/Bridge/Clock/.gitattributes b/src/agent/src/Bridge/Clock/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/Clock/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/Clock/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/Clock/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/Clock/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Clock/.github/close-pull-request.yml b/src/agent/src/Bridge/Clock/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/Clock/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Clock/.gitignore b/src/agent/src/Bridge/Clock/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/Clock/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/Clock/CHANGELOG.md b/src/agent/src/Bridge/Clock/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/Clock/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Toolbox/Tool/Clock.php b/src/agent/src/Bridge/Clock/Clock.php similarity index 97% rename from src/agent/src/Toolbox/Tool/Clock.php rename to src/agent/src/Bridge/Clock/Clock.php index e59f3c3e6..a0ef7ca40 100644 --- a/src/agent/src/Toolbox/Tool/Clock.php +++ b/src/agent/src/Bridge/Clock/Clock.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Clock; use Symfony\AI\Agent\Toolbox\Attribute\AsTool; use Symfony\AI\Agent\Toolbox\Source\HasSourcesInterface; diff --git a/src/agent/src/Bridge/Clock/LICENSE b/src/agent/src/Bridge/Clock/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/Clock/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Bridge/Clock/README.md b/src/agent/src/Bridge/Clock/README.md new file mode 100644 index 000000000..029b22842 --- /dev/null +++ b/src/agent/src/Bridge/Clock/README.md @@ -0,0 +1,12 @@ +Clock AI Tool +============= + +Provides Clock integration for Symfony AI Agent. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) diff --git a/src/agent/tests/Toolbox/Tool/ClockTest.php b/src/agent/src/Bridge/Clock/Tests/ClockTest.php similarity index 92% rename from src/agent/tests/Toolbox/Tool/ClockTest.php rename to src/agent/src/Bridge/Clock/Tests/ClockTest.php index a4c9323b4..40682b9a4 100644 --- a/src/agent/tests/Toolbox/Tool/ClockTest.php +++ b/src/agent/src/Bridge/Clock/Tests/ClockTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Clock\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\Clock; +use Symfony\AI\Agent\Bridge\Clock\Clock; use Symfony\Component\Clock\MockClock; class ClockTest extends TestCase diff --git a/src/agent/src/Bridge/Clock/composer.json b/src/agent/src/Bridge/Clock/composer.json new file mode 100644 index 000000000..6e747216c --- /dev/null +++ b/src/agent/src/Bridge/Clock/composer.json @@ -0,0 +1,48 @@ +{ + "name": "symfony/ai-clock-tool", + "description": "Clock AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "symfony-ai-tool", + "keywords": ["ai", "bridge", "clock", "agent", "tool", "time"], + "authors": [ + { + "name": "Christopher Hertel", + "email": "mail@christopher-hertel.de" + }, + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/ai-agent": "@dev", + "symfony/clock": "^7.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Clock\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Clock\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-main": "0.x-dev" + }, + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/Clock/phpunit.xml.dist b/src/agent/src/Bridge/Clock/phpunit.xml.dist new file mode 100644 index 000000000..f11761533 --- /dev/null +++ b/src/agent/src/Bridge/Clock/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + + diff --git a/src/agent/src/Bridge/Scraper/.gitattributes b/src/agent/src/Bridge/Scraper/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/Scraper/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/Scraper/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/Scraper/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/Scraper/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Scraper/.github/close-pull-request.yml b/src/agent/src/Bridge/Scraper/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/Scraper/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Scraper/.gitignore b/src/agent/src/Bridge/Scraper/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/Scraper/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/Scraper/CHANGELOG.md b/src/agent/src/Bridge/Scraper/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/Scraper/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Bridge/Scraper/LICENSE b/src/agent/src/Bridge/Scraper/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/Scraper/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Bridge/Scraper/README.md b/src/agent/src/Bridge/Scraper/README.md new file mode 100644 index 000000000..06bdd83bd --- /dev/null +++ b/src/agent/src/Bridge/Scraper/README.md @@ -0,0 +1,14 @@ +Web Scraper AI Tool +=================== + +Provides web scraping capabilities for Symfony AI Agent. + +This tool allows AI agents to load the visible text and title from any website by URL. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) diff --git a/src/agent/src/Toolbox/Tool/Scraper.php b/src/agent/src/Bridge/Scraper/Scraper.php similarity index 97% rename from src/agent/src/Toolbox/Tool/Scraper.php rename to src/agent/src/Bridge/Scraper/Scraper.php index f3504af14..dc2cfb55d 100644 --- a/src/agent/src/Toolbox/Tool/Scraper.php +++ b/src/agent/src/Bridge/Scraper/Scraper.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Scraper; use Symfony\AI\Agent\Exception\RuntimeException; use Symfony\AI\Agent\Toolbox\Attribute\AsTool; diff --git a/src/agent/tests/Fixtures/Tool/scraper-page.html b/src/agent/src/Bridge/Scraper/Tests/Fixtures/page.html similarity index 100% rename from src/agent/tests/Fixtures/Tool/scraper-page.html rename to src/agent/src/Bridge/Scraper/Tests/Fixtures/page.html diff --git a/src/agent/tests/Toolbox/Tool/ScraperTest.php b/src/agent/src/Bridge/Scraper/Tests/ScraperTest.php similarity index 85% rename from src/agent/tests/Toolbox/Tool/ScraperTest.php rename to src/agent/src/Bridge/Scraper/Tests/ScraperTest.php index d45da4ea1..4a21a66a8 100644 --- a/src/agent/tests/Toolbox/Tool/ScraperTest.php +++ b/src/agent/src/Bridge/Scraper/Tests/ScraperTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Scraper\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\Scraper; +use Symfony\AI\Agent\Bridge\Scraper\Scraper; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; @@ -20,7 +20,7 @@ final class ScraperTest extends TestCase { public function testInvoke() { - $htmlContent = file_get_contents(__DIR__.'/../../Fixtures/Tool/scraper-page.html'); + $htmlContent = file_get_contents(__DIR__.'/Fixtures/page.html'); $response = new MockResponse($htmlContent); $httpClient = new MockHttpClient($response); @@ -37,7 +37,7 @@ public function testInvoke() public function testSourceIsAdded() { - $htmlContent = file_get_contents(__DIR__.'/../../Fixtures/Tool/scraper-page.html'); + $htmlContent = file_get_contents(__DIR__.'/Fixtures/page.html'); $response = new MockResponse($htmlContent); $httpClient = new MockHttpClient($response); diff --git a/src/agent/src/Bridge/Scraper/composer.json b/src/agent/src/Bridge/Scraper/composer.json new file mode 100644 index 000000000..341166ace --- /dev/null +++ b/src/agent/src/Bridge/Scraper/composer.json @@ -0,0 +1,48 @@ +{ + "name": "symfony/ai-scraper-tool", + "description": "Scraper AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "symfony-ai-tool", + "keywords": ["ai", "bridge", "scraper", "agent", "tool", "web-scraping"], + "authors": [ + { + "name": "Christopher Hertel", + "email": "mail@christopher-hertel.de" + }, + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "masterminds/html5": "^2.8", + "symfony/ai-agent": "@dev", + "symfony/css-selector": "^7.3|^8.0", + "symfony/dom-crawler": "^7.3|^8.0", + "symfony/http-client": "^7.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Scraper\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Scraper\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/Scraper/phpunit.xml.dist b/src/agent/src/Bridge/Scraper/phpunit.xml.dist new file mode 100644 index 000000000..4485622df --- /dev/null +++ b/src/agent/src/Bridge/Scraper/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + + diff --git a/src/agent/src/Bridge/SimilaritySearch/.gitattributes b/src/agent/src/Bridge/SimilaritySearch/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/SimilaritySearch/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/SimilaritySearch/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/SimilaritySearch/.github/close-pull-request.yml b/src/agent/src/Bridge/SimilaritySearch/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/SimilaritySearch/.gitignore b/src/agent/src/Bridge/SimilaritySearch/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/SimilaritySearch/CHANGELOG.md b/src/agent/src/Bridge/SimilaritySearch/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Bridge/SimilaritySearch/LICENSE b/src/agent/src/Bridge/SimilaritySearch/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Bridge/SimilaritySearch/README.md b/src/agent/src/Bridge/SimilaritySearch/README.md new file mode 100644 index 000000000..ff7d34f7c --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/README.md @@ -0,0 +1,12 @@ +SimilaritySearch AI Tool +======================== + +Provides similarity search integration for Symfony AI Agent using vector stores. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) diff --git a/src/agent/src/Toolbox/Tool/SimilaritySearch.php b/src/agent/src/Bridge/SimilaritySearch/SimilaritySearch.php similarity index 96% rename from src/agent/src/Toolbox/Tool/SimilaritySearch.php rename to src/agent/src/Bridge/SimilaritySearch/SimilaritySearch.php index 1e85b49a6..4f750510f 100644 --- a/src/agent/src/Toolbox/Tool/SimilaritySearch.php +++ b/src/agent/src/Bridge/SimilaritySearch/SimilaritySearch.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\SimilaritySearch; use Symfony\AI\Agent\Toolbox\Attribute\AsTool; use Symfony\AI\Store\Document\VectorDocument; diff --git a/src/agent/tests/Toolbox/Tool/SimilaritySearchTest.php b/src/agent/src/Bridge/SimilaritySearch/Tests/SimilaritySearchTest.php similarity index 96% rename from src/agent/tests/Toolbox/Tool/SimilaritySearchTest.php rename to src/agent/src/Bridge/SimilaritySearch/Tests/SimilaritySearchTest.php index 65d07e03e..5f441c089 100644 --- a/src/agent/tests/Toolbox/Tool/SimilaritySearchTest.php +++ b/src/agent/src/Bridge/SimilaritySearch/Tests/SimilaritySearchTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\SimilaritySearch\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch; +use Symfony\AI\Agent\Bridge\SimilaritySearch\SimilaritySearch; use Symfony\AI\Platform\Vector\Vector; use Symfony\AI\Store\Document\Metadata; use Symfony\AI\Store\Document\VectorDocument; diff --git a/src/agent/src/Bridge/SimilaritySearch/composer.json b/src/agent/src/Bridge/SimilaritySearch/composer.json new file mode 100644 index 000000000..ebe24cc6a --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/composer.json @@ -0,0 +1,48 @@ +{ + "name": "symfony/ai-similarity-search-tool", + "description": "SimilaritySearch AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "symfony-ai-tool", + "keywords": ["ai", "bridge", "similarity-search", "agent", "tool", "vector", "search"], + "authors": [ + { + "name": "Christopher Hertel", + "email": "mail@christopher-hertel.de" + }, + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/ai-agent": "@dev", + "symfony/ai-store": "@dev" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\SimilaritySearch\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\SimilaritySearch\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-main": "0.x-dev" + }, + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/SimilaritySearch/phpunit.xml.dist b/src/agent/src/Bridge/SimilaritySearch/phpunit.xml.dist new file mode 100644 index 000000000..2d0553bf6 --- /dev/null +++ b/src/agent/src/Bridge/SimilaritySearch/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + + diff --git a/src/agent/src/Bridge/Wikipedia/.gitattributes b/src/agent/src/Bridge/Wikipedia/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/Wikipedia/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/Wikipedia/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Wikipedia/.github/close-pull-request.yml b/src/agent/src/Bridge/Wikipedia/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Wikipedia/.gitignore b/src/agent/src/Bridge/Wikipedia/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/Wikipedia/CHANGELOG.md b/src/agent/src/Bridge/Wikipedia/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Bridge/Wikipedia/LICENSE b/src/agent/src/Bridge/Wikipedia/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Bridge/Wikipedia/README.md b/src/agent/src/Bridge/Wikipedia/README.md new file mode 100644 index 000000000..5d6880355 --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/README.md @@ -0,0 +1,12 @@ +Wikipedia AI Tool +================= + +Provides [Wikipedia](https://www.wikipedia.org/) integration for Symfony AI Agent. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) diff --git a/src/agent/tests/Fixtures/Tool/wikipedia-article-missing.json b/src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article-missing.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/wikipedia-article-missing.json rename to src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article-missing.json diff --git a/src/agent/tests/Fixtures/Tool/wikipedia-article-redirect.json b/src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article-redirect.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/wikipedia-article-redirect.json rename to src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article-redirect.json diff --git a/src/agent/tests/Fixtures/Tool/wikipedia-article.json b/src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/wikipedia-article.json rename to src/agent/src/Bridge/Wikipedia/Tests/Fixtures/article.json diff --git a/src/agent/tests/Fixtures/Tool/wikipedia-search-empty.json b/src/agent/src/Bridge/Wikipedia/Tests/Fixtures/search-empty.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/wikipedia-search-empty.json rename to src/agent/src/Bridge/Wikipedia/Tests/Fixtures/search-empty.json diff --git a/src/agent/tests/Fixtures/Tool/wikipedia-search-result.json b/src/agent/src/Bridge/Wikipedia/Tests/Fixtures/search-result.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/wikipedia-search-result.json rename to src/agent/src/Bridge/Wikipedia/Tests/Fixtures/search-result.json diff --git a/src/agent/tests/Toolbox/Tool/WikipediaTest.php b/src/agent/src/Bridge/Wikipedia/Tests/WikipediaTest.php similarity index 85% rename from src/agent/tests/Toolbox/Tool/WikipediaTest.php rename to src/agent/src/Bridge/Wikipedia/Tests/WikipediaTest.php index c086f7f8d..c15169aee 100644 --- a/src/agent/tests/Toolbox/Tool/WikipediaTest.php +++ b/src/agent/src/Bridge/Wikipedia/Tests/WikipediaTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Wikipedia\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\Wikipedia; +use Symfony\AI\Agent\Bridge\Wikipedia\Wikipedia; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\JsonMockResponse; @@ -20,7 +20,7 @@ final class WikipediaTest extends TestCase { public function testSearchWithResults() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/wikipedia-search-result.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/Fixtures/search-result.json'); $httpClient = new MockHttpClient($result); $wikipedia = new Wikipedia($httpClient); @@ -47,7 +47,7 @@ public function testSearchWithResults() public function testSearchWithoutResults() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/wikipedia-search-empty.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/Fixtures/search-empty.json'); $httpClient = new MockHttpClient($result); $wikipedia = new Wikipedia($httpClient); @@ -60,7 +60,7 @@ public function testSearchWithoutResults() public function testArticleWithResult() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/wikipedia-article.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/Fixtures/article.json'); $httpClient = new MockHttpClient($result); $wikipedia = new Wikipedia($httpClient); @@ -76,7 +76,7 @@ public function testArticleWithResult() public function testArticleWithRedirect() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/wikipedia-article-redirect.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/Fixtures/article-redirect.json'); $httpClient = new MockHttpClient($result); $wikipedia = new Wikipedia($httpClient); @@ -94,7 +94,7 @@ public function testArticleWithRedirect() public function testArticleMissing() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/wikipedia-article-missing.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/Fixtures/article-missing.json'); $httpClient = new MockHttpClient($result); $wikipedia = new Wikipedia($httpClient); diff --git a/src/agent/src/Toolbox/Tool/Wikipedia.php b/src/agent/src/Bridge/Wikipedia/Wikipedia.php similarity index 98% rename from src/agent/src/Toolbox/Tool/Wikipedia.php rename to src/agent/src/Bridge/Wikipedia/Wikipedia.php index 748c2c235..d70bb945f 100644 --- a/src/agent/src/Toolbox/Tool/Wikipedia.php +++ b/src/agent/src/Bridge/Wikipedia/Wikipedia.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Wikipedia; use Symfony\AI\Agent\Toolbox\Attribute\AsTool; use Symfony\AI\Agent\Toolbox\Source\HasSourcesInterface; diff --git a/src/agent/src/Bridge/Wikipedia/composer.json b/src/agent/src/Bridge/Wikipedia/composer.json new file mode 100644 index 000000000..546dda783 --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/composer.json @@ -0,0 +1,45 @@ +{ + "name": "symfony/ai-wikipedia-tool", + "description": "Wikipedia AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "symfony-ai-tool", + "keywords": ["ai", "bridge", "wikipedia", "agent", "tool"], + "authors": [ + { + "name": "Christopher Hertel", + "email": "mail@christopher-hertel.de" + }, + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/ai-agent": "@dev", + "symfony/http-client": "^7.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Wikipedia\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Wikipedia\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/Wikipedia/phpunit.xml.dist b/src/agent/src/Bridge/Wikipedia/phpunit.xml.dist new file mode 100644 index 000000000..09d71a7be --- /dev/null +++ b/src/agent/src/Bridge/Wikipedia/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + + diff --git a/src/agent/src/Bridge/Youtube/.gitattributes b/src/agent/src/Bridge/Youtube/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/Youtube/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/Youtube/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/Youtube/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/Youtube/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Youtube/.github/close-pull-request.yml b/src/agent/src/Bridge/Youtube/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/Youtube/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Youtube/.gitignore b/src/agent/src/Bridge/Youtube/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/Youtube/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/Youtube/CHANGELOG.md b/src/agent/src/Bridge/Youtube/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/Youtube/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Bridge/Youtube/LICENSE b/src/agent/src/Bridge/Youtube/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/Youtube/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Bridge/Youtube/README.md b/src/agent/src/Bridge/Youtube/README.md new file mode 100644 index 000000000..63f1d6d45 --- /dev/null +++ b/src/agent/src/Bridge/Youtube/README.md @@ -0,0 +1,12 @@ +YouTube AI Tool +=============== + +Provides [YouTube](https://www.youtube.com/) transcript integration for Symfony AI Agent. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) diff --git a/src/agent/tests/Fixtures/Tool/youtube-captions.json b/src/agent/src/Bridge/Youtube/Tests/Fixtures/captions.json similarity index 100% rename from src/agent/tests/Fixtures/Tool/youtube-captions.json rename to src/agent/src/Bridge/Youtube/Tests/Fixtures/captions.json diff --git a/src/agent/tests/Fixtures/Tool/youtube-transcript.xml b/src/agent/src/Bridge/Youtube/Tests/Fixtures/transcript.xml similarity index 100% rename from src/agent/tests/Fixtures/Tool/youtube-transcript.xml rename to src/agent/src/Bridge/Youtube/Tests/Fixtures/transcript.xml diff --git a/src/agent/tests/Fixtures/Tool/youtube-video-page.html b/src/agent/src/Bridge/Youtube/Tests/Fixtures/video-page.html similarity index 100% rename from src/agent/tests/Fixtures/Tool/youtube-video-page.html rename to src/agent/src/Bridge/Youtube/Tests/Fixtures/video-page.html diff --git a/src/agent/tests/Toolbox/Tool/YouTubeTranscriberTest.php b/src/agent/src/Bridge/Youtube/Tests/YoutubeTranscriberTest.php similarity index 61% rename from src/agent/tests/Toolbox/Tool/YouTubeTranscriberTest.php rename to src/agent/src/Bridge/Youtube/Tests/YoutubeTranscriberTest.php index 95201cd32..019b3a660 100644 --- a/src/agent/tests/Toolbox/Tool/YouTubeTranscriberTest.php +++ b/src/agent/src/Bridge/Youtube/Tests/YoutubeTranscriberTest.php @@ -9,24 +9,24 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Youtube\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\YouTubeTranscriber; +use Symfony\AI\Agent\Bridge\Youtube\YoutubeTranscriber; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; -final class YouTubeTranscriberTest extends TestCase +final class YoutubeTranscriberTest extends TestCase { public function testInvoke() { $httpClient = new MockHttpClient([ - MockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/youtube-video-page.html'), - MockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/youtube-captions.json'), - MockResponse::fromFile(__DIR__.'/../../Fixtures/Tool/youtube-transcript.xml'), + MockResponse::fromFile(__DIR__.'/Fixtures/video-page.html'), + MockResponse::fromFile(__DIR__.'/Fixtures/captions.json'), + MockResponse::fromFile(__DIR__.'/Fixtures/transcript.xml'), ]); - $transcriber = new YouTubeTranscriber($httpClient); + $transcriber = new YoutubeTranscriber($httpClient); $result = $transcriber('dQw4w9WgXcQ'); diff --git a/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php b/src/agent/src/Bridge/Youtube/YoutubeTranscriber.php similarity index 95% rename from src/agent/src/Toolbox/Tool/YouTubeTranscriber.php rename to src/agent/src/Bridge/Youtube/YoutubeTranscriber.php index 1257f017f..831d2e7b7 100644 --- a/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php +++ b/src/agent/src/Bridge/Youtube/YoutubeTranscriber.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Youtube; use MrMySQL\YoutubeTranscript\TranscriptListFetcher; use Symfony\AI\Agent\Exception\LogicException; @@ -21,7 +21,7 @@ * @author Christopher Hertel */ #[AsTool('youtube_transcript', 'Fetches the transcript of a YouTube video')] -final class YouTubeTranscriber +final class YoutubeTranscriber { public function __construct( private readonly HttpClientInterface $client, diff --git a/src/agent/src/Bridge/Youtube/composer.json b/src/agent/src/Bridge/Youtube/composer.json new file mode 100644 index 000000000..d5aff192b --- /dev/null +++ b/src/agent/src/Bridge/Youtube/composer.json @@ -0,0 +1,51 @@ +{ + "name": "symfony/ai-youtube-tool", + "description": "YouTube AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "symfony-ai-tool", + "keywords": ["ai", "bridge", "youtube", "agent", "tool", "transcript"], + "authors": [ + { + "name": "Christopher Hertel", + "email": "mail@christopher-hertel.de" + }, + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "mrmysql/youtube-transcript": "^0.0.5", + "nyholm/psr7": "^1.8", + "php-http/discovery": "^1.19", + "symfony/ai-agent": "@dev", + "symfony/http-client": "^7.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Youtube\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Youtube\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-main": "0.x-dev" + }, + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/Youtube/phpunit.xml.dist b/src/agent/src/Bridge/Youtube/phpunit.xml.dist new file mode 100644 index 000000000..7fe2a8044 --- /dev/null +++ b/src/agent/src/Bridge/Youtube/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + +