Replies: 1 comment 5 replies
-
|
It's because you can't start the chat history with an assistant message. The ChatHistory component has a validation process to ensure the chat history is consistent: https://github.com/neuron-core/neuron-ai/blob/2.x/src/Chat/History/AbstractChatHistory.php#L142 It should be enough to put two messages (user and assistant) as the starting point: $agent->chat([
new UserMessage('Hi!'),
new AssistantMessage($opening),
]); |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I wish to create an agent where the first message from the agent is defined. E.g. the user clicks to start a new conversation with a support agent, the initial opening line from the assistant is pre-defined to 'Hello there, how can I help you today?', but this message could change.
Is it possible to inject that message into the start of the conversation? I am using SQL chat history.
This throws an error (No messages in the chat history. It may have been filled with too large a message.)
Appending the message into the messages array adds the message in but the agent doesn't seem to then have context of the opening line.
Beta Was this translation helpful? Give feedback.
All reactions