Class ToolContext
java.lang.Object
org.springframework.ai.chat.model.ToolContext
Represents the context for tool execution in a function calling scenario.
This class encapsulates a map of contextual information that can be passed to tools (functions) when they are called. It provides an immutable view of the context to ensure thread-safety and prevent modification after creation.
The context is typically populated from the toolContext
field of
FunctionCallingOptions
and is used in the function execution process.
- Since:
- 1.0.0
- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorDescriptionToolContext
(Map<String, Object> context) Constructs a new ToolContext with the given context map. -
Method Summary
Modifier and TypeMethodDescriptionReturns the immutable context map.
-
Constructor Details
-
ToolContext
Constructs a new ToolContext with the given context map.- Parameters:
context
- A map containing the tool context information. This map is wrapped in an unmodifiable view to prevent changes.
-
-
Method Details
-
getContext
Returns the immutable context map.- Returns:
- An unmodifiable view of the context map.
-