PromptExecutorBuilder
Builder for constructing a PromptExecutor that automatically selects the appropriate executor implementation based on the registered clients.
Executor selection heuristic (determined at build time):
If every registered provider appears exactly once, a MultiLLMPromptExecutor is created. It dispatches each request to the single client registered for the requested model's provider.
If any provider has more than one client registered, a RoutingLLMPromptExecutor is created. It load-balances requests across all clients for the same provider.
Obtain an instance through PromptExecutor.builder.
Example usage in Java:
// Two distinct providers → MultiLLMPromptExecutor
PromptExecutor executor = PromptExecutor.builder()
.addClient(openAIClient)
.addClient(anthropicClient)
.build();
// Two clients for the same provider → RoutingLLMPromptExecutor (load balanced)
PromptExecutor executor = PromptExecutor.builder()
.addClient(firstOpenAIClient)
.addClient(secondOpenAIClient)
.build();See also
Functions
Registers an additional LLMClient.
Adds an Anthropic client.
Constructs a PromptExecutor from the registered clients.
Adds a Dashscope client.
Adds a DeepSeek client.
Configures a fallback model to use when no client is registered for the requested model's provider.
Adds a Google AI client.
Adds a Mistral AI client.
Adds an Ollama client.
Adds an OpenAI client.
Adds an OpenRouter client.