[Agent] Extract tools to dedicated bridges

This commit is contained in:
Oskar Stark
2025-11-24 11:13:46 +01:00
parent 879602b366
commit a233206841
117 changed files with 876 additions and 101 deletions

View File

@@ -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",

View File

@@ -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'

View File

@@ -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
---------------------

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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",

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 @@ require_once dirname(__DIR__).'/bootstrap.php';
$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]);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 @@ require_once dirname(__DIR__).'/bootstrap.php';
$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]);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 @@ require_once dirname(__DIR__).'/bootstrap.php';
$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]);

View File

@@ -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 @@ require_once dirname(__DIR__).'/bootstrap.php';
$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]);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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",

View File

@@ -0,0 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.git* export-ignore

View File

@@ -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!

View File

@@ -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!

4
src/agent/src/Bridge/Clock/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
vendor/
composer.lock
phpunit.xml
.phpunit.result.cache

View File

@@ -0,0 +1,7 @@
CHANGELOG
=========
0.1
---
* Add the bridge

View File

@@ -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;

View File

@@ -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.

View File

@@ -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)

View File

@@ -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

View File

@@ -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"
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnDeprecation="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Symfony AI Clock Tool Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>

View File

@@ -0,0 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.git* export-ignore

View File

@@ -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!

View File

@@ -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!

View File

@@ -0,0 +1,4 @@
vendor/
composer.lock
phpunit.xml
.phpunit.result.cache

View File

@@ -0,0 +1,7 @@
CHANGELOG
=========
0.1
---
* Add the bridge

View File

@@ -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.

View File

@@ -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)

View File

@@ -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;

View File

@@ -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 @@ final class ScraperTest extends TestCase
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);

View File

@@ -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"
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnDeprecation="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Symfony AI Scraper Tool Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>

View File

@@ -0,0 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.git* export-ignore

View File

@@ -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!

View File

@@ -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!

View File

@@ -0,0 +1,4 @@
vendor/
composer.lock
phpunit.xml
.phpunit.result.cache

View File

@@ -0,0 +1,7 @@
CHANGELOG
=========
0.1
---
* Add the bridge

View File

@@ -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.

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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"
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnDeprecation="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Symfony AI Similarity Search Tool Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>

View File

@@ -0,0 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.git* export-ignore

View File

@@ -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!

View File

@@ -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!

View File

@@ -0,0 +1,4 @@
vendor/
composer.lock
phpunit.xml
.phpunit.result.cache

View File

@@ -0,0 +1,7 @@
CHANGELOG
=========
0.1
---
* Add the bridge

View File

@@ -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.

View File

@@ -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)

View File

@@ -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 @@ final class WikipediaTest extends TestCase
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 @@ final class WikipediaTest extends TestCase
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 @@ final class WikipediaTest extends TestCase
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 @@ final class WikipediaTest extends TestCase
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);

Some files were not shown because too many files have changed in this diff Show More