Skip to content

OllamaApi.ChatResponse.model field is not correctly merged in OllamaApiHelper.merge(ChatResponse, ChatResponse) #4933

@jorander

Description

@jorander

Bug description
OllamaApi.ChatResponse.model field is not correctly merged in OllamaApiHelper.merge(ChatResponse, ChatResponse).

Ollama returns the full model name in each part of a streamed result. As the parts are merged the model names are concatenated, which results in an invalid value.

Environment
Spring AI 1.1

Steps to reproduce
Create two OllamaApi.ChatResonse objects with the model value set. Run them through OllamaApiHelper.merge. In the result the model values are concatenated.

Expected behavior
The value for field model should be taken from one of the parts where it is not null in the same way as the field done is handled.

Minimal Complete Reproducible example
The OllamaApiHelperTests class contans a unittest for this. However, the expected result for the model value is wrong in this test and should be adjusted in accordance with what is described under "Expected behavior" above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions