-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathToolBinaryResult.java
More file actions
125 lines (110 loc) · 3.1 KB
/
ToolBinaryResult.java
File metadata and controls
125 lines (110 loc) · 3.1 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
116
117
118
119
120
121
122
123
124
125
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Binary result from a tool execution.
* <p>
* This class represents binary data (such as images) returned by a tool. The
* data is base64-encoded for JSON transmission.
*
* <h2>Example Usage</h2>
*
* <pre>{@code
* var binaryResult = new ToolBinaryResult().setType("image").setMimeType("image/png")
* .setData(Base64.getEncoder().encodeToString(imageBytes)).setDescription("Generated chart");
* }</pre>
*
* @see ToolResultObject#setBinaryResultsForLlm(java.util.List)
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class ToolBinaryResult {
@JsonProperty("data")
private String data;
@JsonProperty("mimeType")
private String mimeType;
@JsonProperty("type")
private String type;
@JsonProperty("description")
private String description;
/**
* Gets the base64-encoded binary data.
*
* @return the base64-encoded data string
*/
public String getData() {
return data;
}
/**
* Sets the base64-encoded binary data.
*
* @param data
* the base64-encoded data
* @return this result for method chaining
*/
public ToolBinaryResult setData(String data) {
this.data = data;
return this;
}
/**
* Gets the MIME type of the binary data.
*
* @return the MIME type (e.g., "image/png", "application/pdf")
*/
public String getMimeType() {
return mimeType;
}
/**
* Sets the MIME type of the binary data.
*
* @param mimeType
* the MIME type
* @return this result for method chaining
*/
public ToolBinaryResult setMimeType(String mimeType) {
this.mimeType = mimeType;
return this;
}
/**
* Gets the type of binary content.
*
* @return the content type (e.g., "image", "file")
*/
public String getType() {
return type;
}
/**
* Sets the type of binary content.
*
* @param type
* the content type
* @return this result for method chaining
*/
public ToolBinaryResult setType(String type) {
this.type = type;
return this;
}
/**
* Gets the description of the binary content.
*
* @return the content description
*/
public String getDescription() {
return description;
}
/**
* Sets a description of the binary content.
* <p>
* This helps the assistant understand the content.
*
* @param description
* the content description
* @return this result for method chaining
*/
public ToolBinaryResult setDescription(String description) {
this.description = description;
return this;
}
}