spring-ai
spring-ai copied to clipboard
Feature Request: Add the capability to add name-spaced ChatClient configurations
Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.
Expected Behavior
Just as existing open issues touch on being able to override the underlying HTTP clients for models, there are other configurations such as temperature that would be nice to configure.
Ideally, this could be done using a namespace for each ChatClient in externalized configuration (application.properties/application.yml).
An alternative could be to document the idiomatic way of defining several different ChatClient beans.
Current Behavior
Right now, to override timeouts I've resorted to doing something like the following:
@Bean
public RestClientCustomizer restClientCustomizer() {
return restClientBuilder -> restClientBuilder
.requestFactory(ClientHttpRequestFactories.get(
ClientHttpRequestFactorySettings.DEFAULTS
.withConnectTimeout(Duration.ofSeconds(5))
.withReadTimeout(Duration.ofSeconds(60))
));
}
Context
I've started work on an Agent framework similar to Crew AI using Spring AI and have a need to configure ChatClient on a per-agent basis. This would allow temperature or even different LLM per agent to be defined.