Skip to content

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

@ghord

Description

@ghord

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.

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions