spring-projects / spring-projects/spring-ai

Adding extraBody to OllamaChatOptions

Open
#5,928 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.