LlmService

Framework-agnostic LLM service abstraction, parallel to com.embabel.common.ai.model.EmbeddingService.

Implementations wrap specific LLM backends (Spring AI, direct API clients, etc.) and provide a consistent interface for creating message senders.

The type parameter THIS enables fluent builder-style methods that preserve the concrete type through method chaining.

Parameters

THIS

The concrete implementation type for fluent method chaining

See also

for the Spring AI implementation

for the interface used to make LLM calls

Inheritors

Properties

Link copied to clipboard

The knowledge cutoff date of the model, if known.

Link copied to clipboard
abstract val name: String

Name of the LLM, such as "gpt-3.5-turbo"

Link copied to clipboard
abstract val pricingModel: PricingModel?

The pricing model for the LLM, if known.

Link copied to clipboard
Link copied to clipboard
abstract val provider: String

Name of the provider, such as "OpenAI"

Link copied to clipboard
open override val type: ModelType

Functions

Link copied to clipboard

Create a message sender for this LLM configured with the given options.

Link copied to clipboard

Create a message streamer for this LLM configured with the given options.

Link copied to clipboard
abstract fun supportsStreaming(): Boolean

Check if this LLM service supports streaming operations.

Link copied to clipboard

Check if this LLM service supports thinking operations.

Link copied to clipboard

Returns a copy of this LLM service with the specified knowledge cutoff date.

Link copied to clipboard
abstract fun withPromptContributor(promptContributor: PromptContributor): THIS

Returns a copy of this LLM service with an additional prompt contributor.