Package-level declarations

Types

Link copied to clipboard

A PromptExecutor that introduces an explicit resolveModel step before every LLM operation.

Link copied to clipboard
class ModelResolutionException(requestedModel: LLModel, detailedMsg: String? = null, cause: Throwable? = null) : Exception

Exception thrown when model resolution (PromptExecutorAPI.resolveModel) fails for a requested model.

Link copied to clipboard
actual abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

actual abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

expect abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

actual abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

actual abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

actual abstract class PromptExecutor : PromptExecutorAPI

An interface representing an executor for processing LLM prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

Link copied to clipboard
Link copied to clipboard

Builder for constructing a PromptExecutor that automatically selects the appropriate executor implementation based on the registered clients.

Link copied to clipboard

Enum representing different operations that can be performed by the prompt executor.

Link copied to clipboard
data class ResolvedModel(val effectiveModel: LLModel)

Represents a resolved model for use by PromptExecutorAPI. Outcome of PromptExecutorAPI.resolveModel

Link copied to clipboard
class StructureFixingParser(val model: LLModel, val retries: Int, prompt: (builder: PromptBuilder, content: String, structure: Structure<*, *>, exception: SerializationException) -> PromptBuilder = ::defaultFixingPrompt)

Helper fixing parser for handling malformed structured data that uses LLMs to attempt to correct any errors in the provided content to produce valid structured outputs.

Functions

Link copied to clipboard
suspend fun <T> PromptExecutor.executeStructured(prompt: Prompt, model: LLModel, config: StructuredRequestConfig<T>, fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>
inline suspend fun <T> PromptExecutor.executeStructured(prompt: Prompt, model: LLModel, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>
suspend fun <T> PromptExecutor.executeStructured(prompt: Prompt, model: LLModel, serializer: KSerializer<T>, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Executes a prompt with structured output, enhancing it with schema instructions or native structured output parameter, and parses the response into the defined structure.

Link copied to clipboard

Parses a structured response from the assistant message using the provided structured output configuration and language model. If a fixing parser is specified in the configuration, it will be used; otherwise, the structure will be parsed directly.