forked from sashabaranov/go-openai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector_store_files.go
More file actions
46 lines (40 loc) · 1.19 KB
/
vector_store_files.go
File metadata and controls
46 lines (40 loc) · 1.19 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
package openai
import (
"context"
"fmt"
"net/http"
)
type VectorStoreFileRequest struct {
FileId string `json:"file_id"`
}
type VectorStoreFileResp struct {
Id string `json:"id"`
Object string `json:"object"`
UsageBytes int `json:"usage_bytes"`
CreatedAt int `json:"created_at"`
VectorStoreId string `json:"vector_store_id"`
Status string `json:"status"`
LastError interface{} `json:"last_error"`
ChunkingStrategy struct {
Type string `json:"type"`
Static struct {
MaxChunkSizeTokens int `json:"max_chunk_size_tokens"`
ChunkOverlapTokens int `json:"chunk_overlap_tokens"`
} `json:"static"`
} `json:"chunking_strategy"`
httpHeader
}
func (c *Client) CreateVectorStoreFile(ctx context.Context, vectorStoreId string, request VectorStoreFileRequest) (response VectorStoreFileResp, err error) {
urlSuffix := fmt.Sprintf("/vector_stores/%s/files", vectorStoreId)
req, err := c.newRequest(
ctx,
http.MethodPost,
c.fullURL(urlSuffix),
withBody(request),
withBetaAssistantVersion(c.config.AssistantVersion))
if err != nil {
return
}
err = c.sendRequest(req, &response)
return
}