@@ -20,16 +20,26 @@ import (
20
20
// TYPES
21
21
22
22
type reqMessage struct {
23
- Model string `json:"model"`
24
- Messages []* schema.Message `json:"messages,omitempty"`
25
- Stream bool `json:"stream,omitempty"`
26
- System string `json:"system,omitempty"`
27
- MaxTokens int `json:"max_tokens,omitempty"`
23
+ Model string `json:"model"`
24
+ Messages []* schema.Message `json:"messages,omitempty"`
25
+ Stream bool `json:"stream,omitempty"`
26
+ System string `json:"system,omitempty"`
27
+ MaxTokens int `json:"max_tokens,omitempty"`
28
+ Metadata * reqMetadata `json:"metadata,omitempty"`
29
+ StopSequences []string `json:"stop_sequences,omitempty"`
30
+ Temperature float64 `json:"temperature,omitempty"`
31
+ TopK int `json:"top_k,omitempty"`
32
+ TopP float64 `json:"top_p,omitempty"`
33
+ Tools []schema.Tool `json:"tools,omitempty"`
28
34
29
35
// Callbacks
30
36
delta Callback `json:"-"`
31
37
}
32
38
39
+ type reqMetadata struct {
40
+ User string `json:"user_id,omitempty"`
41
+ }
42
+
33
43
type respMessage struct {
34
44
Id string `json:"id"`
35
45
Type string `json:"type,omitempty"`
@@ -87,7 +97,7 @@ const (
87
97
// Send a structured list of input messages with text and/or image content,
88
98
// and the model will generate the next message in the conversation. Use
89
99
// a context to cancel the request, instead of the client-related timeout.
90
- func (c * Client ) Messages (ctx context.Context , messages []* schema.Message , opt ... Opt ) (* schema.Content , error ) {
100
+ func (c * Client ) Messages (ctx context.Context , messages []* schema.Message , opt ... Opt ) ([] schema.Content , error ) {
91
101
var request reqMessage
92
102
var response respMessage
93
103
@@ -120,10 +130,10 @@ func (c *Client) Messages(ctx context.Context, messages []*schema.Message, opt .
120
130
return nil , ErrInternalAppError .With ("No content returned" )
121
131
}
122
132
123
- // TODO: Somehow return Usage and Stop information
133
+ // TODO: Somehow return Usage and Stop information back to the caller
124
134
125
135
// Return success
126
- return & response .Content [ 0 ] , nil
136
+ return response .Content , nil
127
137
}
128
138
129
139
///////////////////////////////////////////////////////////////////////////////
0 commit comments