Uses of Class
dev.langchain4j.service.AiServices
Packages that use AiServices
-
Uses of AiServices in dev.langchain4j.service
Methods in dev.langchain4j.service that return AiServicesModifier and TypeMethodDescriptionstatic <T> AiServices
<T> Begins the construction of an AI Service.AiServices.chatMemory
(ChatMemory chatMemory) Configures the chat memory that will be used to preserve conversation history between method calls.AiServices.chatMemoryProvider
(ChatMemoryProvider chatMemoryProvider) Configures the chat memory provider, which provides a dedicated instance ofChatMemory
for each user/conversation.Configures chat model that will be used under the hood of the AI Service.AiServices.contentRetriever
(ContentRetriever contentRetriever) Configures a content retriever to be invoked on every method call for retrieving relevant content related to the user's message from an underlying data source (e.g., an embedding store in the case of anEmbeddingStoreContentRetriever
).AiServices.hallucinatedToolNameStrategy
(Function<ToolExecutionRequest, ToolExecutionResultMessage> hallucinatedToolNameStrategy) Configures the strategy to be used when the LLM hallucinates a tool name (i.e., attempts to call a nonexistent tool).<I extends InputGuardrail>
AiServices<T> AiServices.inputGuardrailClasses
(Class<? extends I>... guardrailClasses) Configures input guardrail classes for the AI service.<I extends InputGuardrail>
AiServices<T> AiServices.inputGuardrailClasses
(List<Class<? extends I>> guardrailClasses) Configures the input guardrail classes for the AI services.<I extends InputGuardrail>
AiServices<T> AiServices.inputGuardrails
(I... guardrails) Adds the specified input guardrails to the context's guardrail service builder.<I extends InputGuardrail>
AiServices<T> AiServices.inputGuardrails
(List<I> guardrails) Sets the input guardrails to be used by the guardrail service builder in the current context.AiServices.inputGuardrailsConfig
(InputGuardrailsConfig inputGuardrailsConfig) Configures the input guardrails for the AI service context by setting the provided InputGuardrailsConfig.AiServices.maxSequentialToolsInvocations
(int maxSequentialToolsInvocations) AiServices.moderationModel
(ModerationModel moderationModel) Configures a moderation model to be used for automatic content moderation.<O extends OutputGuardrail>
AiServices<T> AiServices.outputGuardrailClasses
(Class<? extends O>... guardrailClasses) Sets the output guardrail classes to be used in the guardrail service.<O extends OutputGuardrail>
AiServices<T> AiServices.outputGuardrailClasses
(List<Class<? extends O>> guardrailClasses) Configures the output guardrail classes for the AI services.<O extends OutputGuardrail>
AiServices<T> AiServices.outputGuardrails
(List<O> guardrails) Configures the output guardrails for the AI service.<O extends OutputGuardrail>
AiServices<T> AiServices.outputGuardrails
(O... guardrails) Configures output guardrails for the AI services.AiServices.outputGuardrailsConfig
(OutputGuardrailsConfig outputGuardrailsConfig) Configures the output guardrails for AI services.AiServices.retrievalAugmentor
(RetrievalAugmentor retrievalAugmentor) Configures a retrieval augmentor to be invoked on every method call.AiServices.streamingChatModel
(StreamingChatModel streamingChatModel) Configures streaming chat model that will be used under the hood of the AI Service.AiServices.systemMessageProvider
(Function<Object, String> systemMessageProvider) Configures the system message provider, which provides a system message to be used each time an AI service is invoked.AiServices.toolProvider
(ToolProvider toolProvider) Configures the tool provider that the LLM can useConfigures the tools that the LLM can use.AiServices.tools
(Collection<Object> objectsWithTools) Configures the tools that the LLM can use.AiServices.tools
(Map<ToolSpecification, ToolExecutor> tools) Configures the tools that the LLM can use. -
Uses of AiServices in dev.langchain4j.spi.services
Methods in dev.langchain4j.spi.services that return AiServicesModifier and TypeMethodDescription<T> AiServices
<T> AiServicesFactory.create
(AiServiceContext context)