Uses of Class
dev.langchain4j.agent.tool.ToolExecutionRequest
Packages that use ToolExecutionRequest
Package
Description
-
Uses of ToolExecutionRequest in dev.langchain4j.agent.tool
Methods in dev.langchain4j.agent.tool that return ToolExecutionRequestModifier and TypeMethodDescriptionToolExecutionRequest.Builder.build()Returns aToolExecutionRequestbuilt from the parameters previously set. -
Uses of ToolExecutionRequest in dev.langchain4j.agentic.agent
Method parameters in dev.langchain4j.agentic.agent with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionAgentBuilder.hallucinatedToolNameStrategy(Function<ToolExecutionRequest, ToolExecutionResultMessage> hallucinatedToolNameStrategy) Sets the strategy for handling tool calls when the model hallucinates a non-existent tool name. -
Uses of ToolExecutionRequest in dev.langchain4j.data.message
Methods in dev.langchain4j.data.message that return types with arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionAiMessage.toolExecutionRequests()Get the tool execution requests of the message.Methods in dev.langchain4j.data.message with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionstatic AiMessageAiMessage.aiMessage(ToolExecutionRequest... toolExecutionRequests) Create a newAiMessagewith the given tool execution requests.static AiMessageAiMessage.from(ToolExecutionRequest... toolExecutionRequests) Create a newAiMessagewith the given tool execution requests.static ToolExecutionResultMessageToolExecutionResultMessage.from(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.static ToolExecutionResultMessageToolExecutionResultMessage.toolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.Method parameters in dev.langchain4j.data.message with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionstatic AiMessageAiMessage.aiMessage(String text, List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given text and tool execution requests.static AiMessageAiMessage.aiMessage(List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given tool execution requests.static AiMessageAiMessage.from(String text, List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given text and tool execution requests.static AiMessageAiMessage.from(List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given tool execution requests.AiMessage.Builder.toolExecutionRequests(List<ToolExecutionRequest> toolExecutionRequests) Constructor parameters in dev.langchain4j.data.message with type arguments of type ToolExecutionRequestModifierConstructorDescriptionAiMessage(String text, List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given text and tool execution requests.AiMessage(List<ToolExecutionRequest> toolExecutionRequests) Create a newAiMessagewith the given tool execution requests. -
Uses of ToolExecutionRequest in dev.langchain4j.internal
Methods in dev.langchain4j.internal that return types with arguments of type ToolExecutionRequest -
Uses of ToolExecutionRequest in dev.langchain4j.mcp
Methods in dev.langchain4j.mcp with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionMcpToolExecutor.execute(ToolExecutionRequest executionRequest, Object memoryId) McpToolExecutor.executeAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread.McpToolExecutor.executeWithContext(ToolExecutionRequest executionRequest, InvocationContext invocationContext) -
Uses of ToolExecutionRequest in dev.langchain4j.mcp.client
Methods in dev.langchain4j.mcp.client with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionDefaultMcpClient.executeTool(ToolExecutionRequest executionRequest) DefaultMcpClient.executeTool(ToolExecutionRequest executionRequest, InvocationContext invocationContext) McpClient.executeTool(ToolExecutionRequest executionRequest) Executes a tool on the MCP server and returns the result.McpClient.executeTool(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Executes a tool on the MCP server and returns the result.DefaultMcpClient.executeToolAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofMcpClient.executeTool(ToolExecutionRequest, InvocationContext): executes a tool on the MCP server without holding a thread while the result is in flight.default CompletableFuture<ToolExecutionResult> McpClient.executeToolAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofMcpClient.executeTool(ToolExecutionRequest, InvocationContext): executes a tool on the MCP server without holding a thread while the result is in flight. -
Uses of ToolExecutionRequest in dev.langchain4j.model.chat.response
Methods in dev.langchain4j.model.chat.response that return ToolExecutionRequestModifier and TypeMethodDescriptionCompleteToolCall.toolExecutionRequest()A fully constructedToolExecutionRequestthat is ready for execution.Constructors in dev.langchain4j.model.chat.response with parameters of type ToolExecutionRequestModifierConstructorDescriptionCompleteToolCall(int index, ToolExecutionRequest toolExecutionRequest) -
Uses of ToolExecutionRequest in dev.langchain4j.model.google.genai
Method parameters in dev.langchain4j.model.google.genai with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionintGoogleGenAiTokenCountEstimator.estimateTokenCountInToolExecutionRequests(Iterable<ToolExecutionRequest> toolExecutionRequests) -
Uses of ToolExecutionRequest in dev.langchain4j.model.googleai
Method parameters in dev.langchain4j.model.googleai with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionintGoogleAiGeminiTokenCountEstimator.estimateTokenCountInToolExecutionRequests(Iterable<ToolExecutionRequest> toolExecutionRequests) -
Uses of ToolExecutionRequest in dev.langchain4j.model.mistralai.internal.mapper
Methods in dev.langchain4j.model.mistralai.internal.mapper that return ToolExecutionRequestModifier and TypeMethodDescriptionstatic ToolExecutionRequestMistralAiMapper.toToolExecutionRequest(MistralAiToolCall mistralAiToolCall) Methods in dev.langchain4j.model.mistralai.internal.mapper that return types with arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionstatic List<ToolExecutionRequest> MistralAiMapper.toToolExecutionRequests(List<MistralAiToolCall> mistralAiToolCalls) -
Uses of ToolExecutionRequest in dev.langchain4j.observability.api.event
Methods in dev.langchain4j.observability.api.event that return ToolExecutionRequestModifier and TypeMethodDescriptionToolCompensatedEvent.request()Gets theToolExecutionRequestof the tool that was compensated.ToolCompensatedEvent.ToolCompensatedEventBuilder.request()ToolExecutedEvent.request()Gets theToolExecutionRequestthat initiated the tool execution.ToolExecutedEvent.ToolExecutedEventBuilder.request()Methods in dev.langchain4j.observability.api.event with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionToolCompensatedEvent.ToolCompensatedEventBuilder.request(ToolExecutionRequest request) Sets the compensated tool's request.ToolExecutedEvent.ToolExecutedEventBuilder.request(ToolExecutionRequest request) Sets the tool execution request. -
Uses of ToolExecutionRequest in dev.langchain4j.observability.event
Methods in dev.langchain4j.observability.event that return ToolExecutionRequest -
Uses of ToolExecutionRequest in dev.langchain4j.service
Method parameters in dev.langchain4j.service with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionAiServices.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). -
Uses of ToolExecutionRequest in dev.langchain4j.service.tool
Classes in dev.langchain4j.service.tool that implement interfaces with type arguments of type ToolExecutionRequestMethods in dev.langchain4j.service.tool that return ToolExecutionRequestModifier and TypeMethodDescriptionBeforeToolExecution.request()Returns the tool execution request that is about to be executed.ToolExecution.request()Returns the request of the tool execution.ToolErrorContext.toolExecutionRequest()Methods in dev.langchain4j.service.tool that return types with arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionToolService.CombinedToolResults.results()Returns the value of theresultsrecord component.Methods in dev.langchain4j.service.tool with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionHallucinatedToolNameStrategy.apply(ToolExecutionRequest toolExecutionRequest) ToolService.applyToolHallucinationStrategy(ToolExecutionRequest toolRequest) DefaultToolExecutor.execute(ToolExecutionRequest request, Object memoryId) ToolExecutor.execute(ToolExecutionRequest request, Object memoryId) Executes a tool request.DefaultToolExecutor.executeAsync(ToolExecutionRequest request, InvocationContext context) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread.default CompletableFuture<ToolExecutionResult> ToolExecutor.executeAsync(ToolExecutionRequest request, InvocationContext context) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread.ToolService.executeTool(InvocationContext invocationContext, Map<String, ToolExecutor> toolExecutors, ToolExecutionRequest toolRequest, Consumer<BeforeToolExecution> externalBeforeToolExecution, Consumer<ToolExecution> externalAfterToolExecution) DefaultToolExecutor.executeWithContext(ToolExecutionRequest request, InvocationContext context) default ToolExecutionResultToolExecutor.executeWithContext(ToolExecutionRequest request, InvocationContext context) Executes a tool request.static ToolExecutionResultToolService.executeWithErrorHandling(ToolExecutionRequest toolRequest, ToolExecutor toolExecutor, InvocationContext invocationContext, ToolArgumentsErrorHandler argumentsErrorHandler, ToolExecutionErrorHandler executionErrorHandler) BeforeToolExecution.Builder.request(ToolExecutionRequest request) ToolExecution.Builder.request(ToolExecutionRequest request) ToolService.startTool(ToolExecutionRequest toolRequest, Map<String, ToolExecutor> toolExecutors, InvocationContext invocationContext, Consumer<BeforeToolExecution> externalBeforeToolExecution, Consumer<ToolExecution> externalAfterToolExecution, Executor executor) Initiates a single tool execution on the givenexecutor, returning a future of its result.ToolErrorContext.Builder.toolExecutionRequest(ToolExecutionRequest toolExecutionRequest) Method parameters in dev.langchain4j.service.tool with type arguments of type ToolExecutionRequestModifier and TypeMethodDescriptionToolService.collectCompensableRound(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolService.CompensableToolExecution> compensableExecutions, InvocationContext invocationContext) Records one completed round's successful compensable tool executions into the sharedaccumulatorand returns the first errored tool's name (ornull).ToolService.collectCompensableRound(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolService.CompensableToolExecution> compensableExecutions, InvocationContext invocationContext) Records one completed round's successful compensable tool executions into the sharedaccumulatorand returns the first errored tool's name (ornull).ToolService.combineToolResultsCollectingErrors(Map<ToolExecutionRequest, CompletableFuture<ToolExecutionResult>> futures) Combines a set of in-flight (possibly already-started) tool executions into a single future of their results, keyed and ordered by request.voidToolService.compensateIfNeeded(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar) Synchronous tool compensation, used by the synchronous /TokenStreammodes.voidToolService.compensateIfNeeded(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar) Synchronous tool compensation, used by the synchronous /TokenStreammodes.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Non-blocking counterpart ofToolService.compensateIfNeeded(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, AiServiceListenerRegistrar), used by theCompletableFutureand reactive modes.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Non-blocking counterpart ofToolService.compensateIfNeeded(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, AiServiceListenerRegistrar), used by theCompletableFutureand reactive modes.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter, boolean alreadyCollected, String preCollectedFailedToolName) AsToolService.compensateIfNeededAsync(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, CompensationReason, AiServiceListenerRegistrar, BiConsumer), but whenalreadyCollectedistruethis round's compensable tools have already been recorded intocompensableExecutions(viaToolService.collectCompensableRound(List, Map, List, InvocationContext)) andpreCollectedFailedToolNamecarries the collect's result; the collection step is then skipped.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter, boolean alreadyCollected, String preCollectedFailedToolName) AsToolService.compensateIfNeededAsync(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, CompensationReason, AiServiceListenerRegistrar, BiConsumer), but whenalreadyCollectedistruethis round's compensable tools have already been recorded intocompensableExecutions(viaToolService.collectCompensableRound(List, Map, List, InvocationContext)) andpreCollectedFailedToolNamecarries the collect's result; the collection step is then skipped.ToolService.compensateOnCancellationAsync(List<ToolExecutionRequest> currentRoundRequests, Map<ToolExecutionRequest, ToolExecutionResult> currentRoundResults, List<ToolService.CompensableToolExecution> compensableExecutions, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Rolls back, on cancellation, every compensable tool that had already executed successfully - across all rounds - implementing the "drain the round, then roll back" contract for the asynchronous and reactive modes.ToolService.compensateOnCancellationAsync(List<ToolExecutionRequest> currentRoundRequests, Map<ToolExecutionRequest, ToolExecutionResult> currentRoundResults, List<ToolService.CompensableToolExecution> compensableExecutions, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Rolls back, on cancellation, every compensable tool that had already executed successfully - across all rounds - implementing the "drain the round, then roll back" contract for the asynchronous and reactive modes.voidToolService.hallucinatedToolNameStrategy(Function<ToolExecutionRequest, ToolExecutionResultMessage> toolHallucinationStrategy) ToolService.prepareNextChatRequest(AiServiceContext context, Object memoryId, List<ChatMessage> messages, InvocationContext invocationContext, ToolServiceContext toolServiceContext, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, ChatRequestParameters parameters) Builds the next round'sChatRequest, shared by every AI Service mode: given the already-resolvedmessagesto send (seeToolService.resolveMessagesForNextRequest(List, AiServiceContext, InvocationContext)), it refreshes dynamic tool providers, folds in any tools found by tool search, overrides the tool specifications on the carried-forwardparameters, applies the chat-request transformer, and fires theAiServiceRequestIssuedEvent.ToolService.processToolResults(AiServiceContext context, List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecution> toolExecutions, InvocationContext invocationContext, ToolServiceContext toolServiceContext) Per-round bookkeeping shared by every AI Service mode (sync,CompletableFuture,TokenStream, reactiveFlow.Publisher): for each executed tool it records aToolExecution, fires theToolExecutedEvent, collects the tool-result message (in request order), and accumulatesanyToolErrored+ the per-toolReturnBehaviors.ToolService.processToolResults(AiServiceContext context, List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecution> toolExecutions, InvocationContext invocationContext, ToolServiceContext toolServiceContext) Per-round bookkeeping shared by every AI Service mode (sync,CompletableFuture,TokenStream, reactiveFlow.Publisher): for each executed tool it records aToolExecution, fires theToolExecutedEvent, collects the tool-result message (in request order), and accumulatesanyToolErrored+ the per-toolReturnBehaviors.Constructors in dev.langchain4j.service.tool with parameters of type ToolExecutionRequestModifierConstructorDescriptionDefaultToolExecutor(Object object, ToolExecutionRequest toolExecutionRequest) Constructor parameters in dev.langchain4j.service.tool with type arguments of type ToolExecutionRequestModifierConstructorDescriptionCombinedToolResults(Map<ToolExecutionRequest, ToolExecutionResult> results, Throwable firstError) Creates an instance of aCombinedToolResultsrecord class. -
Uses of ToolExecutionRequest in dev.langchain4j.service.tool.search
Methods in dev.langchain4j.service.tool.search that return ToolExecutionRequestModifier and TypeMethodDescriptionToolSearchRequest.toolExecutionRequest()Returns the tool call containing the search query.Methods in dev.langchain4j.service.tool.search with parameters of type ToolExecutionRequestModifier and TypeMethodDescriptionToolSearchRequest.Builder.toolExecutionRequest(ToolExecutionRequest toolExecutionRequest)