Skip to content

Commit c9da417

Browse files
feat(api): fix file batches SDK to list_files
1 parent 42bdca7 commit c9da417

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 109
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
33
openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
4-
config_hash: d8706905bf16d9e4141e88d5a778263b
4+
config_hash: 0412cd40c0609550c1a47c69dd104e4f

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ Methods:
248248

249249
- <code title="post /v1/vector_stores/{vector_store_id}/file_batches">client.VectorStores.FileBatches.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, vectorStoreID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchNewParams">VectorStoreFileBatchNewParams</a>) (<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatches">VectorStoreFileBatches</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
250250
- <code title="get /v1/vector_stores/{vector_store_id}/file_batches/{batch_id}">client.VectorStores.FileBatches.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, batchID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchGetParams">VectorStoreFileBatchGetParams</a>) (<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatches">VectorStoreFileBatches</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
251-
- <code title="get /v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files">client.VectorStores.FileBatches.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, batchID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchListParams">VectorStoreFileBatchListParams</a>) (<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/packages/pagination#OpenAICursorPage">OpenAICursorPage</a>[<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFile">VectorStoreFile</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
252251
- <code title="post /v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel">client.VectorStores.FileBatches.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchService.Cancel">Cancel</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, batchID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchCancelParams">VectorStoreFileBatchCancelParams</a>) (<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatches">VectorStoreFileBatches</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
252+
- <code title="get /v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files">client.VectorStores.FileBatches.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchService.ListFiles">ListFiles</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, batchID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFileBatchListFilesParams">VectorStoreFileBatchListFilesParams</a>) (<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/packages/pagination#OpenAICursorPage">OpenAICursorPage</a>[<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#VectorStoreFile">VectorStoreFile</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
253253

254254
# Models
255255

vectorstorefilebatch.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,24 @@ func (r *VectorStoreFileBatchService) Get(ctx context.Context, batchID string, q
6767
return
6868
}
6969

70+
// Cancels a vector store file batch.
71+
func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, batchID string, body VectorStoreFileBatchCancelParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
72+
opts = slices.Concat(r.Options, opts)
73+
if body.VectorStoreID == "" {
74+
err = errors.New("missing required vector_store_id parameter")
75+
return
76+
}
77+
if batchID == "" {
78+
err = errors.New("missing required batch_id parameter")
79+
return
80+
}
81+
path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/cancel", body.VectorStoreID, batchID)
82+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
83+
return
84+
}
85+
7086
// Returns a list of vector store files in a batch.
71-
func (r *VectorStoreFileBatchService) List(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
87+
func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, batchID string, params VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
7288
var raw *http.Response
7389
opts = slices.Concat(r.Options, opts)
7490
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -94,24 +110,8 @@ func (r *VectorStoreFileBatchService) List(ctx context.Context, batchID string,
94110
}
95111

96112
// Returns a list of vector store files in a batch.
97-
func (r *VectorStoreFileBatchService) ListAutoPaging(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) *pagination.OpenAICursorPageAutoPager[VectorStoreFile] {
98-
return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, batchID, params, opts...))
99-
}
100-
101-
// Cancels a vector store file batch.
102-
func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, batchID string, body VectorStoreFileBatchCancelParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
103-
opts = slices.Concat(r.Options, opts)
104-
if body.VectorStoreID == "" {
105-
err = errors.New("missing required vector_store_id parameter")
106-
return
107-
}
108-
if batchID == "" {
109-
err = errors.New("missing required batch_id parameter")
110-
return
111-
}
112-
path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/cancel", body.VectorStoreID, batchID)
113-
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
114-
return
113+
func (r *VectorStoreFileBatchService) ListFilesAutoPaging(ctx context.Context, batchID string, params VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) *pagination.OpenAICursorPageAutoPager[VectorStoreFile] {
114+
return pagination.NewOpenAICursorPageAutoPager(r.ListFiles(ctx, batchID, params, opts...))
115115
}
116116

117117
// Response from listing files in a vector store file batch.
@@ -388,7 +388,12 @@ type VectorStoreFileBatchGetParams struct {
388388
paramObj
389389
}
390390

391-
type VectorStoreFileBatchListParams struct {
391+
type VectorStoreFileBatchCancelParams struct {
392+
VectorStoreID string `path:"vector_store_id,required" json:"-"`
393+
paramObj
394+
}
395+
396+
type VectorStoreFileBatchListFilesParams struct {
392397
VectorStoreID string `path:"vector_store_id,required" json:"-"`
393398
// A cursor for use in pagination. `after` is an object ID that defines your place
394399
// in the list.
@@ -407,16 +412,11 @@ type VectorStoreFileBatchListParams struct {
407412
paramObj
408413
}
409414

410-
// URLQuery serializes [VectorStoreFileBatchListParams]'s query parameters as
415+
// URLQuery serializes [VectorStoreFileBatchListFilesParams]'s query parameters as
411416
// `url.Values`.
412-
func (r VectorStoreFileBatchListParams) URLQuery() (v url.Values, err error) {
417+
func (r VectorStoreFileBatchListFilesParams) URLQuery() (v url.Values, err error) {
413418
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
414419
ArrayFormat: apiquery.ArrayQueryFormatComma,
415420
NestedFormat: apiquery.NestedQueryFormatBrackets,
416421
})
417422
}
418-
419-
type VectorStoreFileBatchCancelParams struct {
420-
VectorStoreID string `path:"vector_store_id,required" json:"-"`
421-
paramObj
422-
}

vectorstorefilebatch_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestVectorStoreFileBatchGet(t *testing.T) {
7575
}
7676
}
7777

78-
func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
78+
func TestVectorStoreFileBatchCancel(t *testing.T) {
7979
baseURL := "http://localhost:4010"
8080
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
8181
baseURL = envURL
@@ -86,16 +86,11 @@ func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
8686
client := llamastackclient.NewClient(
8787
option.WithBaseURL(baseURL),
8888
)
89-
_, err := client.VectorStores.FileBatches.List(
89+
_, err := client.VectorStores.FileBatches.Cancel(
9090
context.TODO(),
9191
"batch_id",
92-
llamastackclient.VectorStoreFileBatchListParams{
92+
llamastackclient.VectorStoreFileBatchCancelParams{
9393
VectorStoreID: "vector_store_id",
94-
After: llamastackclient.String("after"),
95-
Before: llamastackclient.String("before"),
96-
Filter: llamastackclient.String("filter"),
97-
Limit: llamastackclient.Int(0),
98-
Order: llamastackclient.String("order"),
9994
},
10095
)
10196
if err != nil {
@@ -107,7 +102,7 @@ func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
107102
}
108103
}
109104

110-
func TestVectorStoreFileBatchCancel(t *testing.T) {
105+
func TestVectorStoreFileBatchListFilesWithOptionalParams(t *testing.T) {
111106
baseURL := "http://localhost:4010"
112107
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
113108
baseURL = envURL
@@ -118,11 +113,16 @@ func TestVectorStoreFileBatchCancel(t *testing.T) {
118113
client := llamastackclient.NewClient(
119114
option.WithBaseURL(baseURL),
120115
)
121-
_, err := client.VectorStores.FileBatches.Cancel(
116+
_, err := client.VectorStores.FileBatches.ListFiles(
122117
context.TODO(),
123118
"batch_id",
124-
llamastackclient.VectorStoreFileBatchCancelParams{
119+
llamastackclient.VectorStoreFileBatchListFilesParams{
125120
VectorStoreID: "vector_store_id",
121+
After: llamastackclient.String("after"),
122+
Before: llamastackclient.String("before"),
123+
Filter: llamastackclient.String("filter"),
124+
Limit: llamastackclient.Int(0),
125+
Order: llamastackclient.String("order"),
126126
},
127127
)
128128
if err != nil {

0 commit comments

Comments
 (0)