1
1
package azureopenai
2
2
3
- type ChatMessage struct {
4
- Role string `json:"role"`
5
- Content string `json:"content"`
6
- }
3
+ import "github.com/EinStack/glide/pkg/api/schemas"
7
4
8
5
// ChatRequest is an Azure openai-specific request schema
9
6
type ChatRequest struct {
10
- Messages []ChatMessage `json:"messages"`
11
- Temperature float64 `json:"temperature,omitempty"`
12
- TopP float64 `json:"top_p,omitempty"`
13
- MaxTokens int `json:"max_tokens,omitempty"`
14
- N int `json:"n,omitempty"`
15
- StopWords []string `json:"stop,omitempty"`
16
- Stream bool `json:"stream,omitempty"`
17
- FrequencyPenalty int `json:"frequency_penalty,omitempty"`
18
- PresencePenalty int `json:"presence_penalty,omitempty"`
19
- LogitBias * map [int ]float64 `json:"logit_bias,omitempty"`
20
- User * string `json:"user,omitempty"`
21
- Seed * int `json:"seed,omitempty"`
22
- Tools []string `json:"tools,omitempty"`
23
- ToolChoice interface {} `json:"tool_choice,omitempty"`
24
- ResponseFormat interface {} `json:"response_format,omitempty"`
7
+ Messages []schemas. ChatMessage `json:"messages"`
8
+ Temperature float64 `json:"temperature,omitempty"`
9
+ TopP float64 `json:"top_p,omitempty"`
10
+ MaxTokens int `json:"max_tokens,omitempty"`
11
+ N int `json:"n,omitempty"`
12
+ StopWords []string `json:"stop,omitempty"`
13
+ Stream bool `json:"stream,omitempty"`
14
+ FrequencyPenalty int `json:"frequency_penalty,omitempty"`
15
+ PresencePenalty int `json:"presence_penalty,omitempty"`
16
+ LogitBias * map [int ]float64 `json:"logit_bias,omitempty"`
17
+ User * string `json:"user,omitempty"`
18
+ Seed * int `json:"seed,omitempty"`
19
+ Tools []string `json:"tools,omitempty"`
20
+ ToolChoice interface {} `json:"tool_choice,omitempty"`
21
+ ResponseFormat interface {} `json:"response_format,omitempty"`
25
22
}
26
23
27
24
// ChatCompletion
@@ -37,10 +34,10 @@ type ChatCompletion struct {
37
34
}
38
35
39
36
type Choice struct {
40
- Index int `json:"index"`
41
- Message ChatMessage `json:"message"`
42
- Logprobs interface {} `json:"logprobs"`
43
- FinishReason string `json:"finish_reason"`
37
+ Index int `json:"index"`
38
+ Message schemas. ChatMessage `json:"message"`
39
+ Logprobs interface {} `json:"logprobs"`
40
+ FinishReason string `json:"finish_reason"`
44
41
}
45
42
46
43
type Usage struct {
@@ -61,7 +58,7 @@ type ChatCompletionChunk struct {
61
58
}
62
59
63
60
type StreamChoice struct {
64
- Index int `json:"index"`
65
- Delta ChatMessage `json:"delta"`
66
- FinishReason string `json:"finish_reason"`
61
+ Index int `json:"index"`
62
+ Delta schemas. ChatMessage `json:"delta"`
63
+ FinishReason string `json:"finish_reason"`
67
64
}
0 commit comments