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.
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(...)whereval chatOptions = springAiLlm.optionsConverter.convertOptions(options)calls theOllamaChatOptionswhich loose the information about the set model of theSpringAiLlmService. So theSpringAiLlmMessageSenderis initialized with false chatOptions which will be inserted in thePrompt. So embabel falls back to the defaultOllamaChatOptionswhich set mistral as the default when no model is setthis.model = model != null ? model : OllamaModel.MISTRAL.id();.I fixed this locally by excluding the
AgentOllamaAutoConfigurationbyspring.autoconfigure.exclude: com.embabel.agent.autoconfigure.models.ollama.AgentOllamaAutoConfiguration, copying theOllamaModelsConfigand setting a customOllamaOptionsConverterwhich gets the model injected in the constructor and setting the model in theconvertOptionsmethod.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 the
OllamaChatOptionsto not set mistral as default or having a fix in embabel to set theembabel.models.default-llmin 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.OllamaModelsConfigand including the autoconfigure-exclusion in theapplication.propertiesthe 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.