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

.Net: Add public ctor for GeminiChatMessageContent with ToolCalls

Open ionite34 opened this issue 7 months ago • 1 comments

Motivation and Context

Fixes #12153

Since the IReadOnlyList<GeminiFunctionToolCall>? ToolCalls property of GeminiChatMessageContent is get only, and there is no public constructor accepting tool calls like there is for tool call results, it is currently not possible to recreate past history when loading context involving assistant messages with tool calls.

For manual tool invocation, it makes it impossible to recreate the last turn message for responding to the tool use manually.

This PR adds a public constructor to GeminiChatMessageContent accepting a IEnumerable<GeminiFunctionToolCall>

Description

Contribution Checklist

ionite34 avatar May 19 '25 03:05 ionite34

@microsoft-github-policy-service agree

ionite34 avatar May 19 '25 03:05 ionite34

@ionite34 Thanks for the contribution.

GeminiChatMessageContent type is intended to be used only internally, any attempt on reconstructing it should be done using the existing abstractions for FunctionCallContent and FunctionResultContent.

Ideally also for Serialization and Deserialization into the respective specialized type we recommend using the JsonConverter approach, something similar how was done in this PR for OpenAIChatMessageContent.

  • #12352

rogerbarreto avatar Jun 10 '25 08:06 rogerbarreto