spring-projects / spring-projects/spring-ai
Adding extraBody to OllamaChatOptions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Expected Behavior
OpenAIChatOptions supports extraBody that accepts a Map<String, Object> this is added to the request. This feature is usefull when using an OpenAI compatible provider like Perplexity that can use multiple models and extra options.
I would like to suggest you add the same to OllamaChatOptions since it is often used to self host OSS models the provide a variety of options.
Context
I have used a ClientHttpInterceptor for RestClient and ExchangeFilterFunction with a BodyInserter to add extra options to the request for calls to Ollama. We are developing an application that should work with multiple models and provides for configuration according to what the model allows.
It is obvious that the user is responsible for provide valid properties.
It would be useful when and error 400 occur that the body is dumped. Since the LLM may provide feedback on invalid properties.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating OllamaChatOptions and the existing OpenAIChatOptions support for extraBody, then trace how Ollama request bodies and HTTP 400 errors are handled. Done means callers can supply extra request properties through OllamaChatOptions and receive the response body for invalid-property errors, with focused tests covering both behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, ollama
- Domain
- ai, backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100