Mistral AI - Make Client configurable via ChatModel #1416
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change
The
MistralAiClient
provides a convenient way to provide a custom implementation of the underlying HTTP interaction. Using theMistralAiClientBuilderFactory
SPI, it's possible to specify a custom staticBuilder
for aMistralAiClient
.Since an instance of
MistralAiClient
is built internally from that static builder when building aMistralChatClient
object, it's not possible to provide further customizations. For example, it's not possible to include additional configuration parameters toMistralAiClient
, even though the Builder SPI would actually allow that. It's also not possible to initialise theMistralAiClient
instance via dependency injection, resulting in not being able to manage it properly from a Spring application context.This PR aims at solving that problem by making it possible to provide a
MistralAiClient
instance when building aMistralChatClient
object. The additional benefit is making it clearer what parameters are specific to the model integration (like model and temperature) and what are the ones specific to the HTTP client (like timeout and API key).The change extends the current setup to avoid any breaking change. It also marks the previous way of configuring a Client deprecated.
General checklist