tool/ToolProvider.java

langchain4j · langchain4j/src/main/java/dev/langchain4j/service/tool/ToolProvider.java · java · Apache-2.0
ai, tag:embed-classified

Functional interface providing tools for LLM requests, supports dynamic evaluation.

// Source: https://github.com/langchain4j/langchain4j | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package dev.langchain4j.service.tool;

import dev.langchain4j.data.message.UserMessage;
import dev.langchain4j.invocation.InvocationParameters;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.service.MemoryId;

/**
 * A tool provider. It is called when an AI service is invoked and supplies tools for that invocation.
 * <p>
 * Tools returned in {@link ToolProviderResult} will be included in the request to the LLM.
 * <p>
 * By default, a tool provider is called once at the beginning of an AI service invocation.
 * Override {@link #isDynamic()} to return {@code true

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key