Skip to content

.Net: Bug: OllamaPromptExecutionSettings with GetChatMessageContentsAsync = System.InvalidCastException: #10374

Closed
@mphacker

Description

@mphacker

Describe the bug
System.InvalidCastException: 'Unable to cast object of type 'System.Double' to type 'System.Nullable`1[System.Int32]'.' when using OllamaPromptExecutionSettings with GetChatMessageContentsAsync

To Reproduce
Steps to reproduce the behavior:

  1. create an instance of OllamaPromptExecutionSettings and set the Temperature and NumPredict properties.
  2. Execute var chatResponse = await chatCompletionService.GetChatMessageContentsAsync(ChatHistory,settings);
  3. Error is thrown

Expected behavior
Response from local LLM.

Screenshots
N/A

Platform

  • Language: C#
  • Source: Ollama connector: NuGet 1.35.0-alpha, SK: NuGet: 1.35.0
  • AI model: Ollama local
  • IDE: Visual Studio
  • OS: Windows

Additional context
If I remove the settings parameter from the GetchatMessageContentsAsync I get a valid response from the LLM.

Metadata

Metadata

Assignees

Labels

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

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions