Fixes gh-553
Comment From: tzolov
Hey @ThomasVitale , thanks for improving this.
It looks related to the aca8ffd400fd3e3851aec8dc6705c6613d456073 PR I've just merged, but concerns the legacy generate
endpoint only?
Though the ChatClient impl. uses only the new chat completion
endpoint I guess we should to keep the entire OllamaApi up to date.
Could you please rebase and resolve the possible conflicts?
Comment From: tzolov
yeah, I did a mistake with my previous merge. Please rebase after 15628a34b258ef637878a32e0867420ed252f039
Comment From: ThomasVitale
@tzolov thanks, I'll rebase the PR shortly. I can see that a template
field has been added as an option to the ChatRequest
model, but it doesn't look like it's part of the Ollama API for the chat completion
endpoint. It's only used in the generate
endpoint. (https://github.com/ollama/ollama/blob/main/api/types.go#L40)
The Ollama documentation includes it also for the chat completion
endpoint, but that might be a copy/paste mistake in the docs. Looking at the code of the Ollama server, the handler for chat completion requests is always using the template configured in the model and doesn't allow overwriting (https://github.com/ollama/ollama/blob/main/server/routes.go#L1292). From what I could test, the template
field included in the ChatRequest
Java class will simply be ignored by Ollama. I raised the issue on the Ollama project: https://github.com/ollama/ollama/issues/3514
Comment From: ThomasVitale
I've just rebased the PR on top of the current main
.
Comment From: tzolov
Sorry for the mess I caused earlier today. Obviously lacking testing for the options/parameter merging/mapping logic. Will add some today. Thanks again to for the alignment.
Comment From: ThomasVitale
@tzolov no problem! Thanks for the review!