Define default buildRequestPrompt method in ChatModel interface#5841
Define default buildRequestPrompt method in ChatModel interface#5841nicolaskrier wants to merge 1 commit intospring-projects:mainfrom
Conversation
1d6748b to
ba79e4b
Compare
ba79e4b to
86ff629
Compare
- Remove existing implementation when possible - Verify built ChatOptions when required by the vendor - Use different ChatOptions types in OllamaChatModelIT - Polish OllamaChatRequestTests unit tests Signed-off-by: Nicolas Krier <7557886+nicolaskrier@users.noreply.github.com>
86ff629 to
77ad597
Compare
| assertThat(toolDefinitions.get(0).description()).isEqualTo("Overridden function description"); | ||
| } | ||
|
|
||
| @Disabled("temporary disabled") |
There was a problem hiding this comment.
Investigate why this unit test is failing.
|
Hi @ilayaperumalg, I was wondering if you could take a quick look at this PR. It is a follow-up of your recent modifications for Mistral AI vendor. |
|
LGTM. Adds a sensible default |
|
LGTM. The interface default method approach is clean and avoids vendor-specific casting. The aligned buildRequestPrompt() behavior across Ollama/Mistral makes the interface contract more coherent. Warning: the IT-only scope is noted — worth watching during CI. |
anuragg-saxenaa
left a comment
There was a problem hiding this comment.
LGTM. Clean refactor — adds a default method to ChatModel interface and removes matching boilerplate from 8 vendor implementations. Net: +71 / -140 lines across Anthropic, Azure OpenAI, Bedrock Converse, DeepSeek, Google GenAI, MiniMax, Mistral, Ollama, OpenAI. Good pattern. Approved.
Description
ChatOptionswhen required by the vendor,ChatOptionstypes inOllamaChatModelIT,OllamaChatRequestTestsunit tests.Explanations
The goal is to align the behavior of
ChatModel.buildRequestPrompt()across vendors where possible, and to avoid castingChatOptionsto vendor-specific types.Related work
e3e8cca: fix
MistralAiChatModel.buildRequestPrompt()Testing scope
Warning: Integration tests were run locally for Mistral AI and Ollama vendors only.