-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
59 lines (52 loc) · 2.39 KB
/
types.go
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
package sdk
import "time"
// ChatCompletionStreamResponseDelta represents a chat completion delta generated by streamed model responses.
type ChatCompletionStreamResponseDelta struct {
Content string `json:"content,omitempty"`
ToolCalls []ChatCompletionMessageToolCallChunk `json:"tool_calls,omitempty"`
Role string `json:"role,omitempty"`
Refusal string `json:"refusal,omitempty"`
}
// ChatCompletionMessageToolCallChunk represents a chunk of a tool call in a stream response.
type ChatCompletionMessageToolCallChunk struct {
Index int `json:"index"`
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Function struct {
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
} `json:"function,omitempty"`
}
// ChatCompletionTokenLogprob represents token log probability information.
type ChatCompletionTokenLogprob struct {
Token string `json:"token"`
Logprob float64 `json:"logprob"`
Bytes []int `json:"bytes"`
}
// ChatCompletionStreamChoice represents a choice in a streaming chat completion response.
type ChatCompletionStreamChoice struct {
Delta ChatCompletionStreamResponseDelta `json:"delta"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
}
// CreateChatCompletionStreamResponse represents a streamed chunk of a chat completion response.
type CreateChatCompletionStreamResponse struct {
ID string `json:"id"`
Choices []ChatCompletionStreamChoice `json:"choices"`
Created int `json:"created"`
Model string `json:"model"`
SystemFingerprint string `json:"system_fingerprint,omitempty"`
Object string `json:"object"`
Usage *CompletionUsage `json:"usage,omitempty"`
}
// ClientOptions represents the options that can be passed to the client.
type ClientOptions struct {
// APIKey is the API key to use for the client.
APIKey string
// BaseURL is the base URL to use for the client.
BaseURL string
// Timeout is the timeout to use for the client.
Timeout time.Duration
// Tools is the tools to use for the client.
Tools *[]ChatCompletionTool
}