semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: Unable to reconstruct GeminiChatMessageContent ToolCalls for message history

Open ionite34 opened this issue 7 months ago • 0 comments

Since the IReadOnlyList<GeminiFunctionToolCall>? ToolCalls property of GeminiChatMessageContent is get only (https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/Connectors/Connectors.Google/Models/Gemini/GeminiChatMessageContent.cs#L96), and there is no public constructor accepting tool calls like there is for tool call results, it is not possible to recreate past history when loading context involving assistant messages with tool calls.

For manual tool invocation, (since automatic kernel tool execution is broken when Gemini returns non-first part results currently https://github.com/microsoft/semantic-kernel/issues/11651), it also makes it impossible to recreate the last turn message for responding to the tool use manually when receiving streaming responses (since we need to be able to convert the streaming response to a ChatMessageContent to add it to ChatHistory)

Likely solution is adding a public constructor to GeminiChatMessageContent accepting a IEnumerable<GeminiFunctionToolCall>

ionite34 avatar May 19 '25 03:05 ionite34