ChatResponseExtensions.ToChatResponse; No messageId present #299
Replies: 2 comments 2 replies
-
|
Any updated regarding it? AGUI from https://github.com/microsoft/agent-framework is also using MessageId to emit proper events |
Beta Was this translation helpful? Give feedback.
-
|
I see, thanks for the shoutout. To be honest, I mean we could improve the aggregation logic - I'd be happy to review a pull-request, by the way. But I'd draw the whole picture more like this: What would that mean for you? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
When using the OllamaApiClient, after getting the
IAsyncEnumerable<ChatResponseUpdate> responseStreamfromGetStreamingResponseAsync(), 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 theMessageIdto 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