Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 6, 2025

  • Analyze the repository structure and understand the issue
  • Review OpenAIPromptExecutionSettings implementation as reference
  • Build and test the current Ollama connector
  • Add Clone() method to OllamaPromptExecutionSettings
  • Add Freeze() method to OllamaPromptExecutionSettings
  • Change Stop property type from List to IList for consistency with OpenAI
  • Add comprehensive tests for Clone() method
  • Add test for Freeze() method
  • Add ServiceId property to Clone() method (code review feedback)
  • Add test to verify ServiceId is cloned correctly
  • Build and test to verify all changes work correctly
Original prompt

This section details on the original issue you should resolve

<issue_title>.Net: Bug: OllamaPromptExecutionSettings Clone() method does not clone Ollama specific settings</issue_title>
<issue_description>Describe the bug
Calling Clone() on OllamaPromptExecutionSettings instance returns PromptExecutionSettings with Temperature, TopK, TopP and MaxTokens settings lost

To Reproduce

var testSettings = new OllamaPromptExecutionSettings {  Temperature = (float)temperature, TopP = (float)topP };

// Throws `InvalidCastExeception` always as testSettings is of  `PromptExecutionSettings` type. 
// Additionally, testSettings do not contain temperature or topP parameter values (nothing in ExtensionData either)
var result = (OllamaPromptExecutionSettings) testSettings.Clone();

Expected behavior
Object is cloned correctly like in OpenAI provider

Platform

  • Language: C#
  • Source: 1.65.0
  • AI model: Ollama qwen3:32b
  • IDE: Visual Studio
  • OS: Windows

Additional context

I think it should work like OpenAIPromptExecutionSettings, where all information is properly Cloned.
</issue_description>

<agent_instructions>Add the following methods to OllamaPromptExecutionSettings.cs

  1. Clone
  2. FromExecutionSettings

Use the implementations in OpenAIPromptExecutionSettings.cs as examples for how the methods should be implemented.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #13217

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] .Net: Bug: OllamaPromptExecutionSettings Clone() method does not clone Ollama specific settings .NET: Fix OllamaPromptExecutionSettings Clone() method to preserve Ollama-specific settings Oct 6, 2025
Copilot finished work on behalf of markwallace-microsoft October 6, 2025 13:41
@moonbox3 moonbox3 added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Oct 6, 2025
@github-actions github-actions bot changed the title .NET: Fix OllamaPromptExecutionSettings Clone() method to preserve Ollama-specific settings .Net: Fix OllamaPromptExecutionSettings Clone() method to preserve Ollama-specific settings Oct 6, 2025
@markwallace-microsoft markwallace-microsoft marked this pull request as ready for review October 7, 2025 23:49
@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner October 7, 2025 23:49
Copilot finished work on behalf of markwallace-microsoft October 8, 2025 13:31
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Oct 8, 2025
Merged via the queue into main with commit 5948dbc Oct 8, 2025
19 checks passed
@markwallace-microsoft markwallace-microsoft deleted the copilot/fix-75caaa13-771b-479b-93fd-4dd2dc6a1d36 branch October 8, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.Net: Bug: OllamaPromptExecutionSettings Clone() method does not clone Ollama specific settings

6 participants