Skip to content

Commit 26bd55f

Browse files
committed
ref
1 parent ab0f877 commit 26bd55f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/chat/doc/index.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Symfony AI - Chat Component
22
============================
33

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

77
Installation
88
------------
@@ -15,3 +15,19 @@ Install the component using Composer:
1515
1616
Basic Usage
1717
-----------
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+

0 commit comments

Comments
 (0)