File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
Symfony AI - Chat Component
2
2
============================
3
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 .
4
+ The Chat component provides an API to interact with agents, it allows to store messages and retrieve them later
5
+ for future chat and context-retrieving purposes .
6
6
7
7
Installation
8
8
------------
@@ -15,3 +15,19 @@ Install the component using Composer:
15
15
16
16
Basic Usage
17
17
-----------
18
+
19
+ To initiate a chat, you need to instantiate the ``Symfony\AI\Chat\Chat `` along
20
+ with a ``Symfony\AI\Chat\MessageStoreInterface `` and an ``Symfony\AI\Agent\AgentInterface `` ::
21
+
22
+ use Symfony\AI\Agent\Agent;
23
+ use Symfony\AI\Platform\Bridge\OpenAi\Gpt;
24
+ use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
25
+
26
+ $platform = PlatformFactory::create($apiKey);
27
+ $model = new Gpt(Gpt::GPT_4O_MINI);
28
+
29
+ $agent = new Agent($platform, $model);
30
+ $chat = new Chat($agent, new InMemoryStore());
31
+
32
+ $chat->submit(Message::ofUser('Hello'));
33
+
You can’t perform that action at this time.
0 commit comments