microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
22.07k stars 3.29k forks source link

.Net: Fix FunctionChoiceBehavior State Restoration in OllamaPromptExecutionSettings. #9718

Closed shethaadit closed 5 days ago

shethaadit commented 1 week ago

Description

This PR addresses a bug in OllamaPromptExecutionSettings where the FunctionChoiceBehavior state was not properly restored during the conversion process from PromptExecutionSettings. Specifically, the internal state of FunctionChoiceBehavior, including its list of associated functions, was lost during serialization and deserialization.

Motivation and Context

Why is this change required? The lack of proper state restoration led to missing function definitions in HTTP requests when using the Ollama connector, causing failures in scenarios that rely on function calls.

What problem does it solve? This change ensures that the FunctionChoiceBehavior is fully restored when converting execution settings, maintaining the expected behavior for function calls in the Ollama connector.

What scenario does it contribute to? This fix enables consistent and reliable function calling with the Ollama connector, ensuring that defined functions are included in requests and operate as expected.

Related Issues This change fixes the issue described in the bug report, improving usability and reliability when working with function behaviors in Semantic Kernel integrations.

Contribution Checklist

Fixes #9682

raffaeler commented 1 week ago

Out of curiosity, are you going to support images as well? (They currently are not working)

RogerBarreto commented 5 days ago

@raffaeler, please open an issue and (if you could provide your not working example code would be very helpful) we can investigate this. Thanks!