Skip to content

Commit 3788c50

Browse files
committed
docs: split into components
1 parent fa411a1 commit 3788c50

File tree

16 files changed

+612
-1058
lines changed

16 files changed

+612
-1058
lines changed

README.md

Lines changed: 13 additions & 835 deletions
Large diffs are not rendered by default.

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ composer install
2020
#### Configuration
2121

2222
Depending on the examples you want to run, you may need to configure the needed API keys. Therefore, you need to create a
23-
`.env.local` file in the root of the examples directory. This file should contain the environment variables for the
23+
`.env.local` file in the root of the examples' directory. This file should contain the environment variables for the
2424
corresponding example you want to run.
2525

2626
_Now you can run examples standalone or via the example runner._

src/agent/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Symfony AI - Agent Component
2+
3+
The Agent component provides a framework for building AI agents that, sits on top of the Platform and Store components,
4+
allowing you to create agents that can interact with users, perform tasks, and manage workflows.
5+
6+
## Installation
7+
8+
```bash
9+
composer require symfony/ai-agent
10+
```
11+
12+
**This repository is a READ-ONLY sub-tree split**. See
13+
https://github.com/symfony/ai to create issues or submit pull requests.
14+
15+
## Resources
16+
17+
- [Documentation](doc/index.rst)
18+
- [Report issues](https://github.com/symfony/ai/issues) and
19+
[send Pull Requests](https://github.com/symfony/ai/pulls)
20+
in the [main Symfony AI repository](https://github.com/symfony/ai)

src/agent/doc/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Symfony AI - Agent Component
2+
============================
3+
4+
The Agent component provides a framework for building AI agents that, sits on top of the Platform and Store components,
5+
allowing you to create agents that can interact with users, perform tasks, and manage workflows.
6+
7+
Installation
8+
------------
9+
10+
Install the component using Composer:
11+
12+
.. code-block:: terminal
13+
14+
$ composer require symfony/ai-agent

src/ai-bundle/README.md

Lines changed: 7 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -8,169 +8,12 @@ Integration bundle for Symfony AI components.
88
composer require symfony/ai-bundle
99
```
1010

11-
## Configuration
11+
**This repository is a READ-ONLY sub-tree split**. See
12+
https://github.com/symfony/ai to create issues or submit pull requests.
1213

13-
### Simple Example with OpenAI
14+
## Resources
1415

15-
```yaml
16-
# config/packages/ai.yaml
17-
ai:
18-
platform:
19-
openai:
20-
api_key: '%env(OPENAI_API_KEY)%'
21-
agent:
22-
default:
23-
model:
24-
name: 'GPT'
25-
```
26-
27-
### Advanced Example with Anthropic, Azure, Google and multiple agents
28-
```yaml
29-
# config/packages/ai.yaml
30-
ai:
31-
platform:
32-
anthropic:
33-
api_key: '%env(ANTHROPIC_API_KEY)%'
34-
azure:
35-
# multiple deployments possible
36-
gpt_deployment:
37-
base_url: '%env(AZURE_OPENAI_BASEURL)%'
38-
deployment: '%env(AZURE_OPENAI_GPT)%'
39-
api_key: '%env(AZURE_OPENAI_KEY)%'
40-
api_version: '%env(AZURE_GPT_VERSION)%'
41-
google:
42-
api_key: '%env(GOOGLE_API_KEY)%'
43-
agent:
44-
rag:
45-
platform: 'symfony_ai.platform.azure.gpt_deployment'
46-
structured_output: false # Disables support for "output_structure" option, default is true
47-
model:
48-
name: 'GPT'
49-
version: 'gpt-4o-mini'
50-
system_prompt: 'You are a helpful assistant that can answer questions.' # The default system prompt of the agent
51-
include_tools: true # Include tool definitions at the end of the system prompt
52-
tools:
53-
# Referencing a service with #[AsTool] attribute
54-
- 'Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch'
55-
56-
# Referencing a service without #[AsTool] attribute
57-
- service: 'App\Agent\Tool\CompanyName'
58-
name: 'company_name'
59-
description: 'Provides the name of your company'
60-
method: 'foo' # Optional with default value '__invoke'
61-
62-
# Referencing a agent => agent in agent 🤯
63-
- service: 'symfony_ai.agent.research'
64-
name: 'wikipedia_research'
65-
description: 'Can research on Wikipedia'
66-
is_agent: true
67-
research:
68-
platform: 'symfony_ai.platform.anthropic'
69-
model:
70-
name: 'Claude'
71-
tools: # If undefined, all tools are injected into the agent, use "tools: false" to disable tools.
72-
- 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia'
73-
fault_tolerant_toolbox: false # Disables fault tolerant toolbox, default is true
74-
store:
75-
# also azure_search, mongodb and pinecone are supported as store type
76-
chroma_db:
77-
# multiple collections possible per type
78-
default:
79-
collection: 'my_collection'
80-
embedder:
81-
default:
82-
# platform: 'symfony_ai.platform.anthropic'
83-
# store: 'symfony_ai.store.chroma_db.default'
84-
model:
85-
name: 'Embeddings'
86-
version: 'text-embedding-ada-002'
87-
```
88-
89-
## Usage
90-
91-
### Agent Service
92-
93-
Use the `Agent` service to leverage models and tools:
94-
```php
95-
use Symfony\AI\Agent\AgentInterface;
96-
use Symfony\AI\Platform\Message\Message;
97-
use Symfony\AI\Platform\Message\MessageBag;
98-
99-
final readonly class MyService
100-
{
101-
public function __construct(
102-
private AgentInterface $agent,
103-
) {
104-
}
105-
106-
public function submit(string $message): string
107-
{
108-
$messages = new MessageBag(
109-
Message::forSystem('Speak like a pirate.'),
110-
Message::ofUser($message),
111-
);
112-
113-
return $this->agent->call($messages);
114-
}
115-
}
116-
```
117-
118-
### Register Tools
119-
120-
To use existing tools, you can register them as a service:
121-
```yaml
122-
services:
123-
_defaults:
124-
autowire: true
125-
autoconfigure: true
126-
127-
Symfony\AI\Agent\Toolbox\Tool\Clock: ~
128-
Symfony\AI\Agent\Toolbox\Tool\OpenMeteo: ~
129-
Symfony\AI\Agent\Toolbox\Tool\SerpApi:
130-
$apiKey: '%env(SERP_API_KEY)%'
131-
Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch: ~
132-
Symfony\AI\Agent\Toolbox\Tool\Tavily:
133-
$apiKey: '%env(TAVILY_API_KEY)%'
134-
Symfony\AI\Agent\Toolbox\Tool\Wikipedia: ~
135-
Symfony\AI\Agent\Toolbox\Tool\YouTubeTranscriber: ~
136-
```
137-
138-
Custom tools can be registered by using the `#[AsTool]` attribute:
139-
140-
```php
141-
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
142-
143-
#[AsTool('company_name', 'Provides the name of your company')]
144-
final class CompanyName
145-
{
146-
public function __invoke(): string
147-
{
148-
return 'ACME Corp.'
149-
}
150-
}
151-
```
152-
153-
The agent configuration by default will inject all known tools into the agent.
154-
155-
To disable this behavior, set the `tools` option to `false`:
156-
```yaml
157-
ai:
158-
agent:
159-
my_agent:
160-
tools: false
161-
```
162-
163-
To inject only specific tools, list them in the configuration:
164-
```yaml
165-
ai:
166-
agent:
167-
my_agent:
168-
tools:
169-
- 'Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch'
170-
```
171-
172-
### Profiler
173-
174-
The profiler panel provides insights into the agent's execution:
175-
176-
![Profiler](./profiler.png)
16+
- [Documentation](doc/index.rst)
17+
- [Report issues](https://github.com/symfony/ai/issues) and
18+
[send Pull Requests](https://github.com/symfony/ai/pulls)
19+
in the [main Symfony AI repository](https://github.com/symfony/ai)

0 commit comments

Comments
 (0)