Interface LlmService
-
- All Implemented Interfaces:
-
com.embabel.common.ai.model.LlmMetadata,com.embabel.common.ai.model.ModelMetadata,com.embabel.common.ai.prompt.PromptContributorConsumer
public interface LlmService<THIS extends LlmService<THIS>> implements LlmMetadata, PromptContributorConsumerFramework-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.
-
-
Method Summary
Modifier and Type Method Description abstract LlmMessageSendercreateMessageSender(LlmOptions options)Create a message sender for this LLM configured with the given options. abstract THISwithKnowledgeCutoffDate(LocalDate date)Returns a copy of this LLM service with the specified knowledge cutoff date. abstract THISwithPromptContributor(PromptContributor promptContributor)Returns a copy of this LLM service with an additional prompt contributor. -
Methods inherited from class com.embabel.common.ai.model.LlmMetadata
getKnowledgeCutoffDate, getPricingModel, getType -
Methods inherited from class com.embabel.common.ai.model.ModelMetadata
getName, getProvider -
Methods inherited from class com.embabel.common.ai.prompt.PromptContributorConsumer
getPromptContributors -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createMessageSender
abstract LlmMessageSender createMessageSender(LlmOptions options)
Create a message sender for this LLM configured with the given options.
The message sender handles the actual LLM API calls but does NOT execute tools - it returns the LLM's response including any tool call requests.
- Parameters:
options- Configuration options for the LLM call (temperature, max tokens, etc.- Returns:
A message sender configured for this LLM
-
withKnowledgeCutoffDate
abstract THIS withKnowledgeCutoffDate(LocalDate date)
Returns a copy of this LLM service with the specified knowledge cutoff date.
- Parameters:
date- The knowledge cutoff date for the model- Returns:
A new instance with the updated cutoff date
-
withPromptContributor
abstract THIS withPromptContributor(PromptContributor promptContributor)
Returns a copy of this LLM service with an additional prompt contributor.
- Parameters:
promptContributor- The prompt contributor to add- Returns:
A new instance with the added contributor
-
-
-
-