|  | 
| 10 | 10 |  */ | 
| 11 | 11 | 
 | 
| 12 | 12 | use Symfony\AI\Agent\Agent; | 
| 13 |  | -use Symfony\AI\Agent\Chat; | 
| 14 |  | -use Symfony\AI\Agent\Chat\MessageStore\InMemoryStore; | 
|  | 13 | +use Symfony\AI\Chat\Bridge\Local\InMemoryStore; | 
|  | 14 | +use Symfony\AI\Chat\Chat; | 
| 15 | 15 | use Symfony\AI\Platform\Bridge\OpenAi\Gpt; | 
| 16 | 16 | use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory; | 
| 17 | 17 | use Symfony\AI\Platform\Message\Message; | 
|  | 
| 26 | 26 | 
 | 
| 27 | 27 | $store = new InMemoryStore(); | 
| 28 | 28 | 
 | 
| 29 |  | -$firstChat = new Chat($agent, $store); | 
| 30 |  | -$secondChat = new Chat($agent, $store); | 
|  | 29 | +$chat = new Chat($agent, $store); | 
| 31 | 30 | 
 | 
| 32 |  | -$firstChat->initiate(new MessageBag( | 
|  | 31 | +$chat->initiate(new MessageBag( | 
| 33 | 32 |     Message::forSystem('You are a helpful assistant. You only answer with short sentences.'), | 
| 34 |  | -), '_first_chat'); | 
| 35 |  | -$secondChat->initiate(new MessageBag( | 
| 36 |  | -    Message::forSystem('You are a helpful assistant. You only answer with short sentences.'), | 
| 37 |  | -), '_second_chat'); | 
|  | 33 | +)); | 
|  | 34 | + | 
|  | 35 | +$forkedChat = $chat->fork('fork'); | 
| 38 | 36 | 
 | 
| 39 |  | -$firstChat->submit(Message::ofUser('My name is Christopher.')); | 
| 40 |  | -$firstChatMessage = $firstChat->submit(Message::ofUser('What is my name?')); | 
|  | 37 | +$chat->submit(Message::ofUser('My name is Christopher.')); | 
|  | 38 | +$firstChatMessage = $chat->submit(Message::ofUser('What is my name?')); | 
| 41 | 39 | 
 | 
| 42 |  | -$secondChat->submit(Message::ofUser('My name is William.')); | 
| 43 |  | -$secondChatMessage = $secondChat->submit(Message::ofUser('What is my name?')); | 
|  | 40 | +$forkedChat->submit(Message::ofUser('My name is William.')); | 
|  | 41 | +$secondChatMessage = $forkedChat->submit(Message::ofUser('What is my name?')); | 
| 44 | 42 | 
 | 
| 45 | 43 | $firstChatMessageContent = $firstChatMessage->content; | 
| 46 | 44 | $secondChatMessageContent = $secondChatMessage->content; | 
|  | 
0 commit comments