Executors

@ApiStatus.Experimental
object Executors(source)

Provides utility methods for creating instances of JavaPromptExecutor.

The Executors object is designed to simplify the process of configuring and initializing prompt executors that interact with Large Language Model (LLM) clients. It supports both single and multiple LLM providers, enabling flexibility in execution configurations.

This utility ensures that appropriate JavaPromptExecutor instances are created with the required delegates or configurations.

Note: This API is experimental and may change in future versions.

Functions

Link copied to clipboard

Creates and returns a Java-friendly prompt executor that delegates prompt execution to a SingleLLMPromptExecutor.

@ApiStatus.Experimental
fun promptExecutor(llmClients: Map<LLMProvider, LLMClient>): JavaPromptExecutor

Creates a new instance of JavaPromptExecutor using the provided map of LLM clients. The JavaPromptExecutor is configured with a delegated instance of MultiLLMPromptExecutor to handle prompts across multiple LLM providers.

@ApiStatus.Experimental
fun promptExecutor(llmProvider: LLMProvider, llmClient: LLMClient): JavaPromptExecutor

Creates an instance of JavaPromptExecutor by associating a specific LLMProvider with an LLMClient.