3
3
4
4
package entity
5
5
6
- import "github.com/coze-dev/cozeloop-go/internal/util"
6
+ import (
7
+ "github.com/coze-dev/cozeloop-go/internal/util"
8
+ )
7
9
8
10
type Prompt struct {
9
11
WorkspaceID string `json:"workspace_id"`
@@ -29,9 +31,24 @@ const (
29
31
)
30
32
31
33
type Message struct {
32
- Role Role `json:"role"`
33
- Content * string `json:"content,omitempty"`
34
- Parts []* ContentPart `json:"parts,omitempty"`
34
+ Role Role `json:"role"`
35
+ ReasoningContent * string `json:"reasoning_content,omitempty"`
36
+ Content * string `json:"content,omitempty"`
37
+ Parts []* ContentPart `json:"parts,omitempty"`
38
+ ToolCallID * string `json:"tool_call_id,omitempty"`
39
+ ToolCalls []* ToolCall `json:"tool_calls,omitempty"`
40
+ }
41
+
42
+ type ToolCall struct {
43
+ Index int32 `json:"index"`
44
+ ID string `json:"id"`
45
+ Type ToolType `json:"type"`
46
+ FunctionCall * FunctionCall `json:"function_call,omitempty"`
47
+ }
48
+
49
+ type FunctionCall struct {
50
+ Name string `json:"name"`
51
+ Arguments * string `json:"arguments,omitempty"`
35
52
}
36
53
37
54
type Role string
@@ -45,16 +62,18 @@ const (
45
62
)
46
63
47
64
type ContentPart struct {
48
- Type ContentType `json:"type"`
49
- Text * string `json:"text,omitempty"`
50
- ImageURL * string `json:"image_url,omitempty"`
65
+ Type ContentType `json:"type"`
66
+ Text * string `json:"text,omitempty"`
67
+ ImageURL * string `json:"image_url,omitempty"`
68
+ Base64Data * string `json:"base64_data,omitempty"`
51
69
}
52
70
53
71
type ContentType string
54
72
55
73
const (
56
74
ContentTypeText ContentType = "text"
57
75
ContentTypeImageURL ContentType = "image_url"
76
+ ContentTypeBase64Data ContentType = "base64_data"
58
77
ContentTypeMultiPartVariable ContentType = "multi_part_variable"
59
78
)
60
79
@@ -119,6 +138,25 @@ type LLMConfig struct {
119
138
JSONMode * bool `json:"json_mode,omitempty"`
120
139
}
121
140
141
+ type ExecuteParam struct {
142
+ PromptKey string `json:"prompt_key"`
143
+ Version string `json:"version,omitempty"`
144
+ Label string `json:"label,omitempty"`
145
+ VariableVals map [string ]any `json:"variable_vals,omitempty"`
146
+ Messages []* Message `json:"messages,omitempty"`
147
+ }
148
+
149
+ type ExecuteResult struct {
150
+ Message * Message `json:"message,omitempty"`
151
+ FinishReason * string `json:"finish_reason,omitempty"`
152
+ Usage * TokenUsage `json:"usage,omitempty"`
153
+ }
154
+
155
+ type TokenUsage struct {
156
+ InputTokens int `json:"input_tokens"`
157
+ OutputTokens int `json:"output_tokens"`
158
+ }
159
+
122
160
func (p * Prompt ) DeepCopy () * Prompt {
123
161
if p == nil {
124
162
return nil
@@ -181,12 +219,14 @@ func (cp *ContentPart) DeepCopy() *ContentPart {
181
219
return nil
182
220
}
183
221
copied := & ContentPart {
184
- Type : cp .Type ,
185
- ImageURL : cp .ImageURL ,
222
+ Type : cp .Type ,
186
223
}
187
224
if cp .Text != nil {
188
225
copied .Text = util .Ptr (* cp .Text )
189
226
}
227
+ if cp .ImageURL != nil {
228
+ copied .ImageURL = util .Ptr (* cp .ImageURL )
229
+ }
190
230
return copied
191
231
}
192
232
0 commit comments