Skip to content

Mistral is set as prompt chat options instead of configured llm in Ollama starter #1735

Description

@AccsoOliverMichalke

embabel-ollama-mistral-bug.zip

I am having an issue where i can't start up embabel in the 2.0.0-SNAPSHOT with a local Ollama. The agent always tries to run a Mistral LLM instead of the configured default-llm.

I tracked the error down to ChatClientLlmOperations.createMessageSender(...) where val chatOptions = springAiLlm.optionsConverter.convertOptions(options) calls the OllamaChatOptions which loose the information about the set model of the SpringAiLlmService. So the SpringAiLlmMessageSender is initialized with false chatOptions which will be inserted in the Prompt. So embabel falls back to the default OllamaChatOptions which set mistral as the default when no model is set this.model = model != null ? model : OllamaModel.MISTRAL.id();.

I fixed this locally by excluding the AgentOllamaAutoConfiguration by spring.autoconfigure.exclude: com.embabel.agent.autoconfigure.models.ollama.AgentOllamaAutoConfiguration, copying the OllamaModelsConfig and setting a custom OllamaOptionsConverter which gets the model injected in the constructor and setting the model in the convertOptions method.

It's a rather ugly fix, but it shows that it works well and the correct model is chosen instead of mistral. I guess the real idea would be to change the default-behaviour of theOllamaChatOptions to not set mistral as default or having a fix in embabel to set the embabel.models.default-llm in case of a null-model.

I attached a simple project to test this behaviour. Starting it will show the error. On enabling the de.accso.testing.embabel.OllamaModelsConfig and including the autoconfigure-exclusion in the application.properties the error will be gone (But the test will still fail since my agent doesn't work as expected. But you will see that the llm gets called.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions