Class ToolCall
java.lang.Object
io.agentscope.core.chat.completions.model.ToolCall
Represents a tool call in OpenAI-compatible format.
This DTO is used to serialize tool calls in the conversation context, allowing clients to reconstruct the full conversation history including tool invocations.
Example JSON (non-streaming):
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\":\"Hangzhou\"}"
}
}
Example JSON (streaming with index):
{
"index": 0,
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\":\"Hangzhou\"}"
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the function details within a tool call. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()getIndex()getType()voidsetFunction(ToolCall.FunctionCall function) voidvoidvoid
-
Constructor Details
-
ToolCall
public ToolCall()Default constructor for deserialization. -
ToolCall
Creates a new tool call.- Parameters:
id- Unique identifier for this tool callname- Function namearguments- JSON string of function arguments
-
ToolCall
Creates a new tool call with index (for streaming).- Parameters:
index- Index in the tool_calls arrayid- Unique identifier for this tool callname- Function namearguments- JSON string of function arguments
-
-
Method Details
-
getIndex
-
setIndex
-
getId
-
setId
-
getType
-
setType
-
getFunction
-
setFunction
-