-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathToolInvocation.java
More file actions
115 lines (103 loc) · 2.84 KB
/
ToolInvocation.java
File metadata and controls
115 lines (103 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Represents a tool invocation request from the AI assistant.
* <p>
* When the assistant invokes a tool, this object contains the context including
* the session ID, tool call ID, tool name, and arguments parsed from the
* assistant's request.
*
* @see ToolHandler
* @see ToolDefinition
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class ToolInvocation {
private String sessionId;
private String toolCallId;
private String toolName;
private Object arguments;
/**
* Gets the session ID where the tool was invoked.
*
* @return the session ID
*/
public String getSessionId() {
return sessionId;
}
/**
* Sets the session ID.
*
* @param sessionId
* the session ID
* @return this invocation for method chaining
*/
public ToolInvocation setSessionId(String sessionId) {
this.sessionId = sessionId;
return this;
}
/**
* Gets the unique identifier for this tool call.
* <p>
* This ID correlates the tool invocation with its response.
*
* @return the tool call ID
*/
public String getToolCallId() {
return toolCallId;
}
/**
* Sets the tool call ID.
*
* @param toolCallId
* the tool call ID
* @return this invocation for method chaining
*/
public ToolInvocation setToolCallId(String toolCallId) {
this.toolCallId = toolCallId;
return this;
}
/**
* Gets the name of the tool being invoked.
*
* @return the tool name
*/
public String getToolName() {
return toolName;
}
/**
* Sets the tool name.
*
* @param toolName
* the tool name
* @return this invocation for method chaining
*/
public ToolInvocation setToolName(String toolName) {
this.toolName = toolName;
return this;
}
/**
* Gets the arguments passed to the tool.
* <p>
* This is typically a {@code Map<String, Object>} matching the parameter schema
* defined in the tool's {@link ToolDefinition}.
*
* @return the arguments object
*/
public Object getArguments() {
return arguments;
}
/**
* Sets the tool arguments.
*
* @param arguments
* the arguments object
* @return this invocation for method chaining
*/
public ToolInvocation setArguments(Object arguments) {
this.arguments = arguments;
return this;
}
}