Update go version

This commit is contained in:
dwrz
2026-08-21 10:23:37 +00:00
parent 78248a6145
commit c2e2d9ea02
466 changed files with 67766 additions and 2881 deletions

View File

@@ -17,6 +17,7 @@ const (
BatchEndpointChatCompletions BatchEndpoint = "/v1/chat/completions"
BatchEndpointCompletions BatchEndpoint = "/v1/completions"
BatchEndpointEmbeddings BatchEndpoint = "/v1/embeddings"
BatchEndpointResponses BatchEndpoint = "/v1/responses"
)
type BatchLineItem interface {
@@ -54,6 +55,18 @@ type BatchEmbeddingRequest struct {
URL BatchEndpoint `json:"url"`
}
type BatchResponseRequest struct {
CustomID string `json:"custom_id"`
Body CreateResponseRequest `json:"body"`
Method string `json:"method"`
URL BatchEndpoint `json:"url"`
}
func (r BatchResponseRequest) MarshalBatchLineItem() []byte {
marshal, _ := json.Marshal(r)
return marshal
}
func (r BatchEmbeddingRequest) MarshalBatchLineItem() []byte {
marshal, _ := json.Marshal(r)
return marshal
@@ -146,7 +159,7 @@ func (r *UploadBatchFileRequest) AddChatCompletion(customerID string, body ChatC
r.Lines = append(r.Lines, BatchChatCompletionRequest{
CustomID: customerID,
Body: body,
Method: "POST",
Method: http.MethodPost,
URL: BatchEndpointChatCompletions,
})
}
@@ -155,7 +168,7 @@ func (r *UploadBatchFileRequest) AddCompletion(customerID string, body Completio
r.Lines = append(r.Lines, BatchCompletionRequest{
CustomID: customerID,
Body: body,
Method: "POST",
Method: http.MethodPost,
URL: BatchEndpointCompletions,
})
}
@@ -164,11 +177,20 @@ func (r *UploadBatchFileRequest) AddEmbedding(customerID string, body EmbeddingR
r.Lines = append(r.Lines, BatchEmbeddingRequest{
CustomID: customerID,
Body: body,
Method: "POST",
Method: http.MethodPost,
URL: BatchEndpointEmbeddings,
})
}
func (r *UploadBatchFileRequest) AddResponse(customerID string, body CreateResponseRequest) {
r.Lines = append(r.Lines, BatchResponseRequest{
CustomID: customerID,
Body: body,
Method: http.MethodPost,
URL: BatchEndpointResponses,
})
}
// UploadBatchFile — upload batch file.
func (c *Client) UploadBatchFile(ctx context.Context, request UploadBatchFileRequest) (File, error) {
if request.FileName == "" {