From 64728341305b0b74ad2af956c116c1ec1c241a34 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Sun, 18 Jan 2026 17:17:49 -0800 Subject: [PATCH] fix(core): add default value for OllamaProvider.default_prompt_formatter (#8911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Ollama providers are synced to DB via sync_base_providers(), the default_prompt_formatter field is lost because ProviderCreate doesn't include it. When loading from DB and calling cast_to_subtype(), Pydantic validation fails because the field is required. This was a latent bug exposed when provider models persistence was re-enabled in 0.16.2. The field was always required but never persisted. Adding a default value ("chatml") fixes the issue. The field isn't actually used in the current implementation - the model_wrapper line is commented out in list_llm_models_async() since Ollama now uses OpenAI-compatible endpoints. Fixes: letta-ai/letta-code#587 👾 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta --- letta/schemas/providers/ollama.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/letta/schemas/providers/ollama.py b/letta/schemas/providers/ollama.py index 356ed7b7..0e07ef63 100644 --- a/letta/schemas/providers/ollama.py +++ b/letta/schemas/providers/ollama.py @@ -24,7 +24,8 @@ class OllamaProvider(OpenAIProvider): base_url: str = Field(..., description="Base URL for the Ollama API.") api_key: str | None = Field(None, description="API key for the Ollama API (default: `None`).") default_prompt_formatter: str = Field( - ..., description="Default prompt formatter (aka model wrapper) to use on a /completions style API." + default="chatml", + description="Default prompt formatter (aka model wrapper) to use on a /completions style API.", ) @property