Add HTTP client configuration support for Spring AI models#4970
Add HTTP client configuration support for Spring AI models#4970Fottas wants to merge 17 commits intospring-projects:mainfrom
Conversation
785b410 to
109c099
Compare
fe18cd3 to
1f0cdf8
Compare
SummaryThis PR adds comprehensive HTTP client configuration support (timeouts, SSL, redirects) for 12 Spring AI model providers. The implementation is based on each provider's underlying HTTP client, ensuring consistency with Spring Boot's configuration patterns while maintaining backward compatibility. Scope of ChangesModified Providers (12 total)
Providers Not Modified
Implementation ApproachPattern 1: RestClient-based Providers (Recommended)Applied to 10 providers using Spring RestClient with Providers: DeepSeek, Anthropic, ElevenLabs, Google GenAI, MiniMax, Mistral AI, Ollama, OpenAI, Stability AI, ZhiPu AI Key Components:
Configuration Example: spring:
ai:
deepseek:
api-key: ${DEEPSEEK_API_KEY}
http-client:
enabled: true
connect-timeout: 10s
read-timeout: 60s
redirects: follow
ssl-bundle: my-ssl-bundlePattern 2: Azure SDK-based ProvidersApplied to 2 providers using Azure/OCI SDKs with direct timeout configuration in ConnectionProperties. Providers: Azure OpenAI, OCI GenAI Key Components:
Configuration Example: spring:
ai:
azure:
openai:
api-key: ${AZURE_OPENAI_API_KEY}
endpoint: ${AZURE_OPENAI_ENDPOINT}
connect-timeout: 10s
read-timeout: 90sKey Design Decisions
Code Statistics
Main File Types Changed
Commit HistoryChronological commit log:
Usage ExamplesBasic Configurationspring:
ai:
openai:
api-key: ${OPENAI_API_KEY}
http-client:
connect-timeout: 15s
read-timeout: 120sAdvanced Configuration (SSL + Redirects)spring:
ai:
anthropic:
api-key: ${ANTHROPIC_API_KEY}
http-client:
connect-timeout: 10s
read-timeout: 90s
redirects: follow
ssl-bundle: custom-sslDisable Custom Configurationspring:
ai:
deepseek:
api-key: ${DEEPSEEK_API_KEY}
http-client:
enabled: false # Use default RestClient configurationTestingAll modified providers include:
Related IssueResolves #4934 Future Work
Notes
|
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
…y using HttpClientSettingsProperties don't adjust XxxConnectionProperties inheritance relationships Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Signed-off-by: yinh <fottas@163.com>
Document HTTP client configuration options for 12 model providers, enabling users to customize timeouts, connection pools, and SSL settings. Changes: - Add HTTP client properties documentation for RestClient-based providers (DeepSeek, Anthropic, OpenAI, Ollama, MiniMax, Mistral AI, ZhiPu AI, Stability AI, ElevenLabs) - Add timeout and connection pool properties for Azure OpenAI - Add timeout and connection properties for Google GenAI - Add timeout and async thread properties for OCI GenAI All properties are optional with no default values, allowing users to configure HTTP client behavior based on their specific requirements. Signed-off-by: yinh <fottas@163.com>
0a6c0ed to
24d708e
Compare
Signed-off-by: yinh <fottas@163.com>
24d708e to
6a3a12e
Compare
Summary
Add HTTP client configuration support (timeouts, SSL, etc.) for Spring AI model providers where applicable. Each provider's configuration depends on its underlying HTTP client implementation.
Changes
This PR adds HTTP client configuration properties for the following providers:
DeepSeek
Anthropic
(Add other models you modified...)
Notes
#4934