Chat History
Learn how Neuron AI manage multi turn conversations.
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
$message = Agent::make()
->chat(new UserMessage("What's my name?"))
->getMessage();
echo $message->getContent();
// I'm sorry I don't know your name. Do you want to tell me more about yourself?use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
$agent = Agent::make()
$message = $agent->chat(new UserMessage("Hi, my name is Valerio!"))->getMessage();
echo $message->getContent();
// Hi Valerio, nice to meet you, how can I help you today?
$message = $agent->chat(new UserMessage("Do you remember my name?"))->getMessage();
echo $message->getContent();
// Sure, your name is Valerio!How Chat History works
How to feed a previous conversation
Register the chat history
Available Chat History Implementations
InMemoryChatHistory
FileChatHistory
SQLChatHistory
Laravel
Symfony
EloquentChatHisotry
Example ChatMessage model
Use in your agent
Implement custom chat history
Serialize/Deserialize Messages
Last updated