Update go version
This commit is contained in:
28
vendor/github.com/sashabaranov/go-openai/batch.go
generated
vendored
28
vendor/github.com/sashabaranov/go-openai/batch.go
generated
vendored
@@ -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 == "" {
|
||||
|
||||
Reference in New Issue
Block a user