Class AiServiceTokenStreamParameters.Builder
java.lang.Object
dev.langchain4j.service.AiServiceTokenStreamParameters.Builder
- Enclosing class:
AiServiceTokenStreamParameters
Builder for
AiServiceTokenStreamParameters.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionavailableTools(List<ToolSpecification> availableTools) Sets all available tool specifications configured for AI service.build()Builds a newAiServiceTokenStreamParameters.commonGuardrailParams(GuardrailRequestParams commonGuardrailParams) Sets the common guardrail parameters for validating interactions between a user and a language model.context(AiServiceContext context) Sets the AI service context.effectiveTools(List<ToolSpecification> effectiveTools) Sets effective tool specifications that should be included in the nextChatRequest.invocationContext(InvocationContext invocationContext) messages(List<ChatMessage> messages) Sets the messages.Sets the method key.retrievedContents(List<Content> retrievedContents) Sets the retrieved contents.toolExecutor(Executor toolExecutor) toolExecutors(Map<String, ToolExecutor> toolExecutors) Sets the tool executors.toolSpecifications(List<ToolSpecification> effectiveTools) Deprecated.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
messages
Sets the messages.- Parameters:
messages- the messages- Returns:
- this builder
-
effectiveTools
public AiServiceTokenStreamParameters.Builder effectiveTools(List<ToolSpecification> effectiveTools) Sets effective tool specifications that should be included in the nextChatRequest.- See Also:
-
toolSpecifications
@Deprecated(since="1.12.0") public AiServiceTokenStreamParameters.Builder toolSpecifications(List<ToolSpecification> effectiveTools) Deprecated.useeffectiveTools(List)insteadSets effective tool specifications that should be included in the nextChatRequest.- See Also:
-
availableTools
public AiServiceTokenStreamParameters.Builder availableTools(List<ToolSpecification> availableTools) Sets all available tool specifications configured for AI service. These tool specifications can be discovered/found by the LLM (seeToolSearchStrategy) and included in the nextChatRequest.- Since:
- 1.12.0
- See Also:
-
toolExecutors
public AiServiceTokenStreamParameters.Builder toolExecutors(Map<String, ToolExecutor> toolExecutors) Sets the tool executors.- Parameters:
toolExecutors- the tool executors- Returns:
- this builder
-
toolArgumentsErrorHandler
public AiServiceTokenStreamParameters.Builder toolArgumentsErrorHandler(ToolArgumentsErrorHandler handler) - Since:
- 1.4.0
-
toolExecutionErrorHandler
public AiServiceTokenStreamParameters.Builder toolExecutionErrorHandler(ToolExecutionErrorHandler handler) - Since:
- 1.4.0
-
toolExecutor
- Since:
- 1.4.0
-
retrievedContents
Sets the retrieved contents.- Parameters:
retrievedContents- the retrieved contents- Returns:
- this builder
-
context
Sets the AI service context.- Parameters:
context- the AI service context- Returns:
- this builder
-
invocationContext
public AiServiceTokenStreamParameters.Builder invocationContext(InvocationContext invocationContext) -
commonGuardrailParams
public AiServiceTokenStreamParameters.Builder commonGuardrailParams(GuardrailRequestParams commonGuardrailParams) Sets the common guardrail parameters for validating interactions between a user and a language model.- Parameters:
commonGuardrailParams- an instance ofGuardrailRequestParamscontaining the shared parameters required for guardrail checks, such as chat memory, user message template, and additional variables.- Returns:
- this builder instance.
-
methodKey
Sets the method key.- Parameters:
methodKey- the method key- Returns:
- this builder
-
build
Builds a newAiServiceTokenStreamParameters.- Returns:
- a new
AiServiceTokenStreamParameters
-
effectiveTools(List)instead