Delete typings
Browse files- typings/duckgo/request.go +0 -23
- typings/duckgo/response.go +0 -9
- typings/official/request.go +0 -21
- typings/official/response.go +0 -162
- typings/typings.go +0 -10
typings/duckgo/request.go
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
package duckgo
|
| 2 |
-
|
| 3 |
-
type ApiRequest struct {
|
| 4 |
-
Model string `json:"model"`
|
| 5 |
-
Messages []messages `json:"messages"`
|
| 6 |
-
}
|
| 7 |
-
type messages struct {
|
| 8 |
-
Role string `json:"role"`
|
| 9 |
-
Content string `json:"content"`
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
func (a *ApiRequest) AddMessage(role string, content string) {
|
| 13 |
-
a.Messages = append(a.Messages, messages{
|
| 14 |
-
Role: role,
|
| 15 |
-
Content: content,
|
| 16 |
-
})
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
func NewApiRequest(model string) ApiRequest {
|
| 20 |
-
return ApiRequest{
|
| 21 |
-
Model: model,
|
| 22 |
-
}
|
| 23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typings/duckgo/response.go
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
package duckgo
|
| 2 |
-
|
| 3 |
-
type ApiResponse struct {
|
| 4 |
-
Message string `json:"message"`
|
| 5 |
-
Created int `json:"created"`
|
| 6 |
-
Id string `json:"id"`
|
| 7 |
-
Action string `json:"action"`
|
| 8 |
-
Model string `json:"model"`
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typings/official/request.go
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
package official
|
| 2 |
-
|
| 3 |
-
type APIRequest struct {
|
| 4 |
-
Messages []api_message `json:"messages"`
|
| 5 |
-
Stream bool `json:"stream"`
|
| 6 |
-
Model string `json:"model"`
|
| 7 |
-
PluginIDs []string `json:"plugin_ids"`
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
type api_message struct {
|
| 11 |
-
Role string `json:"role"`
|
| 12 |
-
Content interface{} `json:"content"`
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
type OpenAISessionToken struct {
|
| 16 |
-
SessionToken string `json:"session_token"`
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
type OpenAIRefreshToken struct {
|
| 20 |
-
RefreshToken string `json:"refresh_token"`
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typings/official/response.go
DELETED
|
@@ -1,162 +0,0 @@
|
|
| 1 |
-
package official
|
| 2 |
-
|
| 3 |
-
import "encoding/json"
|
| 4 |
-
|
| 5 |
-
type ChatCompletionChunk struct {
|
| 6 |
-
ID string `json:"id"`
|
| 7 |
-
Object string `json:"object"`
|
| 8 |
-
Created int64 `json:"created"`
|
| 9 |
-
Model string `json:"model"`
|
| 10 |
-
Choices []Choices `json:"choices"`
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
func (chunk *ChatCompletionChunk) String() string {
|
| 14 |
-
resp, _ := json.Marshal(chunk)
|
| 15 |
-
return string(resp)
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
type Choices struct {
|
| 19 |
-
Delta Delta `json:"delta"`
|
| 20 |
-
Index int `json:"index"`
|
| 21 |
-
FinishReason interface{} `json:"finish_reason"`
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
type Delta struct {
|
| 25 |
-
Content string `json:"content,omitempty"`
|
| 26 |
-
Role string `json:"role,omitempty"`
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
func NewChatCompletionChunk(text string) ChatCompletionChunk {
|
| 30 |
-
return ChatCompletionChunk{
|
| 31 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 32 |
-
Object: "chat.completion.chunk",
|
| 33 |
-
Created: 0,
|
| 34 |
-
Model: "gpt-4o-mini",
|
| 35 |
-
Choices: []Choices{
|
| 36 |
-
{
|
| 37 |
-
Index: 0,
|
| 38 |
-
Delta: Delta{
|
| 39 |
-
Content: text,
|
| 40 |
-
},
|
| 41 |
-
FinishReason: nil,
|
| 42 |
-
},
|
| 43 |
-
},
|
| 44 |
-
}
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
func NewChatCompletionChunkWithModel(text string, model string) ChatCompletionChunk {
|
| 48 |
-
return ChatCompletionChunk{
|
| 49 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 50 |
-
Object: "chat.completion.chunk",
|
| 51 |
-
Created: 0,
|
| 52 |
-
Model: model,
|
| 53 |
-
Choices: []Choices{
|
| 54 |
-
{
|
| 55 |
-
Index: 0,
|
| 56 |
-
Delta: Delta{
|
| 57 |
-
Content: text,
|
| 58 |
-
},
|
| 59 |
-
FinishReason: nil,
|
| 60 |
-
},
|
| 61 |
-
},
|
| 62 |
-
}
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
func StopChunkWithModel(reason string, model string) ChatCompletionChunk {
|
| 66 |
-
return ChatCompletionChunk{
|
| 67 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 68 |
-
Object: "chat.completion.chunk",
|
| 69 |
-
Created: 0,
|
| 70 |
-
Model: model,
|
| 71 |
-
Choices: []Choices{
|
| 72 |
-
{
|
| 73 |
-
Index: 0,
|
| 74 |
-
FinishReason: reason,
|
| 75 |
-
},
|
| 76 |
-
},
|
| 77 |
-
}
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
func StopChunk(reason string) ChatCompletionChunk {
|
| 81 |
-
return ChatCompletionChunk{
|
| 82 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 83 |
-
Object: "chat.completion.chunk",
|
| 84 |
-
Created: 0,
|
| 85 |
-
Model: "gpt-4o-mini",
|
| 86 |
-
Choices: []Choices{
|
| 87 |
-
{
|
| 88 |
-
Index: 0,
|
| 89 |
-
FinishReason: reason,
|
| 90 |
-
},
|
| 91 |
-
},
|
| 92 |
-
}
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
type ChatCompletion struct {
|
| 96 |
-
ID string `json:"id"`
|
| 97 |
-
Object string `json:"object"`
|
| 98 |
-
Created int64 `json:"created"`
|
| 99 |
-
Model string `json:"model"`
|
| 100 |
-
Usage usage `json:"usage"`
|
| 101 |
-
Choices []Choice `json:"choices"`
|
| 102 |
-
}
|
| 103 |
-
type Msg struct {
|
| 104 |
-
Role string `json:"role"`
|
| 105 |
-
Content string `json:"content"`
|
| 106 |
-
}
|
| 107 |
-
type Choice struct {
|
| 108 |
-
Index int `json:"index"`
|
| 109 |
-
Message Msg `json:"message"`
|
| 110 |
-
FinishReason interface{} `json:"finish_reason"`
|
| 111 |
-
}
|
| 112 |
-
type usage struct {
|
| 113 |
-
PromptTokens int `json:"prompt_tokens"`
|
| 114 |
-
CompletionTokens int `json:"completion_tokens"`
|
| 115 |
-
TotalTokens int `json:"total_tokens"`
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
func NewChatCompletionWithModel(text string, model string) ChatCompletion {
|
| 119 |
-
return ChatCompletion{
|
| 120 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 121 |
-
Object: "chat.completion",
|
| 122 |
-
Created: int64(0),
|
| 123 |
-
Model: model,
|
| 124 |
-
Usage: usage{
|
| 125 |
-
PromptTokens: 0,
|
| 126 |
-
CompletionTokens: 0,
|
| 127 |
-
TotalTokens: 0,
|
| 128 |
-
},
|
| 129 |
-
Choices: []Choice{
|
| 130 |
-
{
|
| 131 |
-
Message: Msg{
|
| 132 |
-
Content: text,
|
| 133 |
-
Role: "assistant",
|
| 134 |
-
},
|
| 135 |
-
Index: 0,
|
| 136 |
-
},
|
| 137 |
-
},
|
| 138 |
-
}
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
func NewChatCompletion(full_test string, input_tokens, output_tokens int) ChatCompletion {
|
| 142 |
-
return ChatCompletion{
|
| 143 |
-
ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK",
|
| 144 |
-
Object: "chat.completion",
|
| 145 |
-
Created: int64(0),
|
| 146 |
-
Model: "gpt-4o-mini",
|
| 147 |
-
Usage: usage{
|
| 148 |
-
PromptTokens: input_tokens,
|
| 149 |
-
CompletionTokens: output_tokens,
|
| 150 |
-
TotalTokens: input_tokens + output_tokens,
|
| 151 |
-
},
|
| 152 |
-
Choices: []Choice{
|
| 153 |
-
{
|
| 154 |
-
Message: Msg{
|
| 155 |
-
Content: full_test,
|
| 156 |
-
Role: "assistant",
|
| 157 |
-
},
|
| 158 |
-
Index: 0,
|
| 159 |
-
},
|
| 160 |
-
},
|
| 161 |
-
}
|
| 162 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typings/typings.go
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
package typings
|
| 2 |
-
|
| 3 |
-
type GenericResponseLine struct {
|
| 4 |
-
Line string `json:"line"`
|
| 5 |
-
Error string `json:"error"`
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
type StringStruct struct {
|
| 9 |
-
Text string `json:"text"`
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|