-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathmodels_chat.go
More file actions
85 lines (71 loc) · 2.82 KB
/
Copy pathmodels_chat.go
File metadata and controls
85 lines (71 loc) · 2.82 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package meilisearch
import "time"
type ChatWorkspace struct {
UID string `json:"uid"`
}
type ChatWorkspaceSettings struct {
Source ChatSource `json:"source"`
OrgId string `json:"orgId"`
ProjectId string `json:"projectId"`
ApiVersion string `json:"apiVersion"`
DeploymentId string `json:"deploymentId"`
BaseUrl string `json:"baseUrl"`
ApiKey string `json:"apiKey,omitempty"`
Prompts *ChatWorkspaceSettingsPrompts `json:"prompts"`
}
type ChatWorkspaceSettingsPrompts struct {
System string `json:"system"`
SearchDescription string `json:"searchDescription"`
SearchQParam string `json:"searchQParam"`
SearchFilterParam string `json:"searchFilterParam"`
SearchIndexUidParam string `json:"searchIndexUidParam"`
}
type ListChatWorkspace struct {
Results []*ChatWorkspace `json:"results"`
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
Total int64 `json:"total"`
}
type ListChatWorkSpaceQuery struct {
Limit int64
Offset int64
}
type ChatCompletionQuery struct {
Model string `json:"model"`
Messages []*ChatCompletionMessage `json:"messages"`
Stream bool `json:"stream"`
}
type ChatCompletionMessage struct {
Role ChatRole `json:"role"`
Content string `json:"content"`
}
type ChatCompletionStreamChunk struct {
ID string `json:"id"`
Object *string `json:"object,omitempty"`
Created Timestampz `json:"created,omitempty"`
Model string `json:"model,omitempty"`
Choices []*ChatCompletionChoice `json:"choices"`
ServiceTier *string `json:"service_tier,omitempty"`
SystemFingerprint *string `json:"system_fingerprint,omitempty"`
Usage any `json:"usage,omitempty"`
}
type ChatCompletionChoice struct {
Index int64 `json:"index"`
Delta *ChatCompletionChoiceDelta `json:"delta"`
FinishReason *string `json:"finish_reason,omitempty"`
Logprobs any `json:"logprobs"`
}
type ChatCompletionChoiceDelta struct {
Content *string `json:"content,omitempty"`
Role *ChatRole `json:"role,omitempty"`
Refusal *string `json:"refusal,omitempty"`
FunctionCall *string `json:"function_call,omitempty"`
ToolCalls *string `json:"tool_calls,omitempty"`
}
type Timestampz int64
func (t Timestampz) String() string {
return time.Unix(int64(t), 0).UTC().Format(time.RFC3339)
}
func (t Timestampz) ToTime() time.Time {
return time.Unix(int64(t), 0).UTC()
}