Skip to content

.Net: Unable to reconstruct GeminiChatMessageContent ToolCalls for message history #12153

@ionite34

Description

@ionite34

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 #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>

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codePR: in progressUnder development and/or addressing feedbackbugSomething isn't working

Type

Projects

Status

Community PRs

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions