ChatResponseExtensions.ToChatResponse; No messageId present #299
Unanswered
flintlouis
asked this question in
Q&A
Replies: 0 comments
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.
-
Hi,
When using the OllamaApiClient, after getting the
IAsyncEnumerable<ChatResponseUpdate> responseStream
fromGetStreamingResponseAsync()
, I use theChatResponseExtensions.ToChatResponse()
from Micrsoft.Extensions.AI to squash all the seperate response chunks into a ChatResponse with a list of response messages. This extension uses theMessageId
to distuingish which response chunks belong to which message and seperates it in this way.But with the ChatResponseStream there are no message ID's implemented so this extension method just adds all AIContent into 1 message, even if it has a different role.
I was wondering, is it an idea to add messageId's to the ollama Message?
Example:
Before:
responseChunks =
[
{ role: assistant, content: [text] },
{ role: assistant, content: [tool_call] },
{ role: tool, content: [tool_response] },
{ role: assistant, content: [text] }
]
After:
response.Messages =
[
{ role: assistant, content: [text, tool_call, tool_response, text] }
]
Beta Was this translation helpful? Give feedback.
All reactions