Replies: 1 comment
-
You can follow the conversation and progress about the HTTP Client configuration enhancements in #512 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I am currently working on a project that leverages multiple providers, each with its own starter module, such as GEMINI, OPENAI, AZURE, and BEDROCK. Each module contains a
chatModel
that follows the same interface but is specific to each provider. EachchatModel
relies on different HTTP clients to make the actual requests.For example:
VertexAI
RestClient.Builder
andWebClient.Builder
OpenAIClient
Anthropic3ChatBedrockApi
The OPENAI implementation appears to be the most integrated with the Spring ecosystem, as it leverages Spring's
RestClient
andWebClient
, which are part of the Spring Framework. In contrast, the other providers rely on their own custom HTTP client implementations, which are specific to each provider's SDK.Problem Statement
I want to have a unified way to define HTTP client configurations and use Rest and WebClient for all providers. This would simplify the configuration and make it easier to manage multiple providers in a single project. Here is an example of what I have in mind:
In this example,
ClientConfig
is a custom configuration class that holds various HTTP client settings such as timeouts and connection pool sizes. This method creates aWebClient
instance with a customClientHttpConnector
that uses Apache HttpComponents.Then, you can reuse this method to inject different versions of the
WebClient
like:Questions
I believe a unified way to make HTTP calls would be highly beneficial for projects that require more than one provider. Looking forward to your thoughts and suggestions!
Beta Was this translation helpful? Give feedback.
All reactions