Skip to content

Commit 1e38dc5

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

File tree

12 files changed

+327
-846
lines changed

12 files changed

+327
-846
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/mcp-bundle/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,4 @@ mcp:
5959
arguments: [] # Arguments to pass to the command
6060
sse:
6161
url: 'http://localhost:8000/sse' # URL to SSE endpoint of MCP server
62-
6362
```

src/mcp-sdk/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ https://github.com/symfony/ai to create issues or submit pull requests.
1717

1818
## Resources
1919

20-
- [Documentation](doc/index.rst)
21-
- [Report issues](https://github.com/symfony/ai/issues) and
22-
[send Pull Requests](https://github.com/symfony/ai/pulls)
23-
in the [main Symfony AI repository](https://github.com/symfony/ai)
24-
25-
[1]: https://symfony.com/backers
26-
[3]: https://symfony.com/sponsor
20+
- [Documentation](doc/index.rst)
21+
- [Report issues](https://github.com/symfony/ai/issues) and
22+
[send Pull Requests](https://github.com/symfony/ai/pulls)
23+
in the [main Symfony AI repository](https://github.com/symfony/ai)

src/mcp-sdk/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ a PHP application and an LLM model.
77
Installation
88
------------
99

10-
Install the bundle using Composer:
10+
Install the SDK using Composer:
1111

1212
.. code-block:: terminal
1313

src/platform/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Symfony AI - Platform Component
2+
3+
The Platform component provides an abstraction for interacting with different models, their providers and contracts.
4+
5+
## Installation
6+
7+
```bash
8+
composer require symfony/ai-platform
9+
```
10+
11+
**This repository is a READ-ONLY sub-tree split**. See
12+
https://github.com/symfony/ai to create issues or submit pull requests.
13+
14+
## Resources
15+
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)

src/platform/doc/index.rst

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
Symfony AI - Store Component
2+
============================
3+
4+
The Platform component provides an abstraction for interacting with different models, their providers and contracts.
5+
6+
Installation
7+
------------
8+
9+
Install the component using Composer:
10+
11+
.. code-block:: terminal
12+
13+
$ composer require symfony/ai-platform
14+
15+
Purpose
16+
-------
17+
18+
The Platform component provides a unified interface for working with various AI models, hosted and run by different
19+
providers. It allows developers to easily switch between different AI models and providers without changing their
20+
application code. This is particularly useful for applications that require flexibility in choosing AI models based on
21+
specific use cases or performance requirements.
22+
23+
Usage
24+
-----
25+
26+
The instantiation of the ``Symfony\AI\Platform\Platform`` class is usually delegated to a provider-specific factory,
27+
with a provider being OpenAI, Azure, Google, Replicate, and others.
28+
29+
For example, to use the OpenAI provider, you would typically do something like this:
30+
31+
.. code-block: php
32+
33+
use Symfony\AI\Platform\Bridge\OpenAI\Embeddings;
34+
use Symfony\AI\Platform\Bridge\OpenAI\GPT;
35+
use Symfony\AI\Platform\Bridge\OpenAI\PlatformFactory;
36+
37+
// Platform
38+
$platform = PlatformFactory::create($_ENV['OPENAI_API_KEY']);
39+
40+
// Embeddings Model
41+
$embeddings = new Embeddings();
42+
43+
// Language Model in version gpt-4o-mini
44+
$gpt = new GPT(GPT::GPT_4O_MINI);
45+
46+
And with a ``Symfony\AI\Platform\PlatformInterface`` instance, and a ``Symfony\AI\Platform\Model`` instance, you can now
47+
use the platform to interact with the AI model:
48+
49+
.. code-block: php
50+
51+
// Generate a vector embedding for a text, returns a Symfony\AI\Platform\Response\VectorResponse
52+
$response = $platform->request($embeddings, 'What is the capital of France?');
53+
54+
// Generate a text completion with GPT, returns a Symfony\AI\Platform\Response\TextResponse
55+
$embeddingsResult = $platform->request($gpt, new MessageBag(Message::ofUser('What is the capital of France?'));
56+
57+
Depending on the model and its capabilities, different types of inputs and outputs are supported, which results in a
58+
very flexible and powerful interface for working with AI models.
59+
60+
Models
61+
------
62+
63+
The component provides a model base class ``Symfony\AI\Platform\Model`` which is a combination of a model name, a set of
64+
capabilities, and additional options. Usually, bridges to specific providers extend this base class to provide a quick
65+
start for vendor-specific models and their capabilities, see ``Symfony\AI\Platform\Bridge\Anthropic\Claude`` or
66+
``Symfony\AI\Platform\Bridge\OpenAI\GPT``.
67+
68+
**Capabilities** are a list of strings defined by ``Symfony\AI\Platform\Capability``, which can be used to check if a model
69+
supports a specific feature, like ``Capability::INPUT_AUDIO`` or ``Capability::OUTPUT_IMAGE``.
70+
71+
**Options** are additional parameters that can be passed to the model, like ``temperature`` or ``max_tokens``, and are
72+
usually defined by the specific models and their documentation.
73+
74+
Language Models and Messages
75+
----------------------------
76+
77+
One central feature of the Platform component is the support for language models and easing the interaction with them.
78+
This is supported by providing an extensive set of data classes around the concept of messages and their content.
79+
80+
Messages can be of different types, most importantly ``UserMessage``, ``SystemMessage``, or ``AssistantMessage``, can
81+
have different content types, like ``Text``, ``Image`` or ``Audio``, and can be grouped into a ``MessageBag``:
82+
83+
.. code-block: php
84+
85+
use Symfony\AI\Platform\Message\Content\Image;
86+
use Symfony\AI\Platform\Message\Message;
87+
use Symfony\AI\Platform\Message\MessageBag;
88+
89+
// Create a message bag with a user message
90+
$messageBag = new MessageBag(
91+
Message::ofSystem('You are a helpful assistant.')
92+
Message::ofUser('Please describe this picture?', Image::fromFile('/path/to/image.jpg')),
93+
);
94+
95+
Supported Models & Platforms
96+
----------------------------
97+
98+
* **Language Models**
99+
* `OpenAI's GPT`_ with `OpenAI`_ and `Azure`_ as Platform
100+
* `Anthropic's Claude`_ with `Anthropic`_ and `AWS Bedrock`_ as Platform
101+
* `Meta's Llama`_ with `Azure`_, `Ollama`_, `Replicate`_ and `AWS Bedrock`_ as Platform
102+
* `Google's Gemini`_ with `Google`_ and `OpenRouter`_ as Platform
103+
* `DeepSeek's R1`_ with `OpenRouter`_ as Platform
104+
* `Amazon's Nova`_ with `AWS Bedrock`_ as Platform
105+
* `Mistral's Mistral`_ with `Mistral`_ as Platform
106+
* **Embeddings Models**
107+
* `OpenAI's Text Embeddings`_ with `OpenAI`_ and `Azure`_ as Platform
108+
* `Voyage's Embeddings`_ with `Voyage`_ as Platform
109+
* `Mistral Embed`_ with `Mistral`_ as Platform
110+
* **Other Models**
111+
* `OpenAI's Dall·E`_ with `OpenAI`_ as Platform
112+
* `OpenAI's Whisper`_ with `OpenAI`_ and `Azure`_ as Platform
113+
* All models provided by `HuggingFace`_ can be listed with a command in the examples folder,
114+
and also filtered, e.g. ``php examples/huggingface/_model-listing.php --provider=hf-inference --task=object-detection``
115+
116+
See `GitHub`_ for planned support of other models and platforms.
117+
118+
.. _`OpenAI's GPT`: https://platform.openai.com/docs/models/overview
119+
.. _`OpenAI`: https://platform.openai.com/docs/overview
120+
.. _`Azure`: https://learn.microsoft.com/azure/ai-services/openai/concepts/models
121+
.. _`Anthropic's Claude`: https://www.anthropic.com/claude
122+
.. _`Anthropic`: https://www.anthropic.com/
123+
.. _`AWS Bedrock`: https://aws.amazon.com/bedrock/
124+
.. _`Meta's Llama`: https://www.llama.com/
125+
.. _`Ollama`: https://ollama.com/
126+
.. _`Replicate`: https://replicate.com/
127+
.. _`Google's Gemini`: https://gemini.google.com/
128+
.. _`Google`: https://ai.google.dev/
129+
.. _`OpenRouter`: https://www.openrouter.com/
130+
.. _`DeepSeek's R1`: https://www.deepseek.com/
131+
.. _`Amazon's Nova`: https://nova.amazon.com
132+
.. _`Mistral's Mistral`: https://www.mistral.ai/
133+
.. _`Mistral`: https://www.mistral.ai/
134+
.. _`OpenAI's Text Embeddings`: https://platform.openai.com/docs/guides/embeddings/embedding-models
135+
.. _`Voyage's Embeddings`: https://docs.voyageai.com/docs/embeddings
136+
.. _`Voyage`: https://www.voyageai.com/
137+
.. _`Mistral Embed`: https://www.mistral.ai/
138+
.. _`OpenAI's Dall·E`: https://platform.openai.com/docs/guides/image-generation
139+
.. _`OpenAI's Whisper`: https://platform.openai.com/docs/guides/speech-to-text
140+
.. _`HuggingFace`: https://huggingface.co/
141+
.. _`GitHub`: https://github.com/symfony/ai/issues/16

src/store/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Symfony AI - Store Component
2+
3+
The Store component provides a low-level abstraction for storing and retrieving documents in a vector store.
4+
5+
## Installation
6+
7+
```bash
8+
composer require symfony/ai-store
9+
```
10+
11+
**This repository is a READ-ONLY sub-tree split**. See
12+
https://github.com/symfony/ai to create issues or submit pull requests.
13+
14+
## Resources
15+
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)