33
44package entity
55
6- import "github.com/coze-dev/cozeloop-go/internal/util"
6+ import (
7+ "github.com/coze-dev/cozeloop-go/internal/util"
8+ )
79
810type Prompt struct {
911 WorkspaceID string `json:"workspace_id"`
@@ -29,9 +31,24 @@ const (
2931)
3032
3133type 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"`
3552}
3653
3754type Role string
@@ -45,16 +62,18 @@ const (
4562)
4663
4764type 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"`
5169}
5270
5371type ContentType string
5472
5573const (
5674 ContentTypeText ContentType = "text"
5775 ContentTypeImageURL ContentType = "image_url"
76+ ContentTypeBase64Data ContentType = "base64_data"
5877 ContentTypeMultiPartVariable ContentType = "multi_part_variable"
5978)
6079
@@ -119,6 +138,25 @@ type LLMConfig struct {
119138 JSONMode * bool `json:"json_mode,omitempty"`
120139}
121140
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+
122160func (p * Prompt ) DeepCopy () * Prompt {
123161 if p == nil {
124162 return nil
@@ -181,12 +219,14 @@ func (cp *ContentPart) DeepCopy() *ContentPart {
181219 return nil
182220 }
183221 copied := & ContentPart {
184- Type : cp .Type ,
185- ImageURL : cp .ImageURL ,
222+ Type : cp .Type ,
186223 }
187224 if cp .Text != nil {
188225 copied .Text = util .Ptr (* cp .Text )
189226 }
227+ if cp .ImageURL != nil {
228+ copied .ImageURL = util .Ptr (* cp .ImageURL )
229+ }
190230 return copied
191231}
192232
0 commit comments