Issue
Currently, the keep-alive
option is handled inconsistently between models.
- In OllamaEmbeddingModel, a duration parser is used to process the keep-alive option.
- In OllamaChatModel, the raw user input is passed directly without parsing.
https://github.com/spring-projects/spring-ai/blob/d83c82650cd20298436b837ec4f939756d173303/models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/OllamaEmbeddingModel.java#L203-L232
Proposed Solution For better consistency, we should either:
- Remove the duration parser from OllamaEmbeddingModel, or
- Apply the duration parser to OllamaChatModel as well.