Skip to content

Commit 8c3eb65

Browse files
feat(api): OpenAPI spec update via Stainless API (#349)
1 parent eec1865 commit 8c3eb65

File tree

6 files changed

+4
-532
lines changed

6 files changed

+4
-532
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 1259
1+
configured_endpoints: 1249

api.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5194,21 +5194,6 @@ Types:
51945194
- <code><a href="./src/resources/vectorize/indexes.ts">IndexInsert</a></code>
51955195
- <code><a href="./src/resources/vectorize/indexes.ts">IndexQuery</a></code>
51965196
- <code><a href="./src/resources/vectorize/indexes.ts">IndexUpsert</a></code>
5197-
- <code><a href="./src/resources/vectorize/indexes.ts">IndexDeleteResponse</a></code>
5198-
- <code><a href="./src/resources/vectorize/indexes.ts">IndexGetByIDsResponse</a></code>
5199-
5200-
Methods:
5201-
5202-
- <code title="post /accounts/{account_identifier}/vectorize/indexes">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">create</a>(accountIdentifier, { ...params }) -> CreateIndex | null</code>
5203-
- <code title="put /accounts/{account_identifier}/vectorize/indexes/{index_name}">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">update</a>(accountIdentifier, indexName, { ...params }) -> CreateIndex | null</code>
5204-
- <code title="get /accounts/{account_identifier}/vectorize/indexes">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">list</a>(accountIdentifier) -> CreateIndicesSinglePage</code>
5205-
- <code title="delete /accounts/{account_identifier}/vectorize/indexes/{index_name}">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">delete</a>(accountIdentifier, indexName) -> IndexDeleteResponse</code>
5206-
- <code title="post /accounts/{account_identifier}/vectorize/indexes/{index_name}/delete-by-ids">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">deleteByIds</a>(accountIdentifier, indexName, { ...params }) -> IndexDeleteVectorsByID | null</code>
5207-
- <code title="get /accounts/{account_identifier}/vectorize/indexes/{index_name}">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">get</a>(accountIdentifier, indexName) -> CreateIndex | null</code>
5208-
- <code title="post /accounts/{account_identifier}/vectorize/indexes/{index_name}/get-by-ids">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">getByIds</a>(accountIdentifier, indexName, { ...params }) -> IndexGetByIDsResponse | null</code>
5209-
- <code title="post /accounts/{account_identifier}/vectorize/indexes/{index_name}/insert">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">insert</a>(accountIdentifier, indexName, { ...params }) -> IndexInsert | null</code>
5210-
- <code title="post /accounts/{account_identifier}/vectorize/indexes/{index_name}/query">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">query</a>(accountIdentifier, indexName, { ...params }) -> IndexQuery | null</code>
5211-
- <code title="post /accounts/{account_identifier}/vectorize/indexes/{index_name}/upsert">client.vectorize.indexes.<a href="./src/resources/vectorize/indexes.ts">upsert</a>(accountIdentifier, indexName, { ...params }) -> IndexUpsert | null</code>
52125197

52135198
# URLScanner
52145199

src/resources/vectorize/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ export {
77
IndexInsert,
88
IndexQuery,
99
IndexUpsert,
10-
IndexDeleteResponse,
11-
IndexGetByIDsResponse,
12-
IndexCreateParams,
13-
IndexUpdateParams,
14-
IndexDeleteByIDsParams,
15-
IndexGetByIDsParams,
16-
IndexInsertParams,
17-
IndexQueryParams,
18-
IndexUpsertParams,
19-
CreateIndicesSinglePage,
2010
Indexes,
2111
} from './indexes';
2212
export { Vectorize } from './vectorize';

src/resources/vectorize/indexes.ts

Lines changed: 3 additions & 265 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,9 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from 'cloudflare/core';
43
import { APIResource } from 'cloudflare/resource';
54
import * as IndexesAPI from 'cloudflare/resources/vectorize/indexes';
6-
import { SinglePage } from 'cloudflare/pagination';
75

8-
export class Indexes extends APIResource {
9-
/**
10-
* Creates and returns a new Vectorize Index.
11-
*/
12-
create(
13-
accountIdentifier: string,
14-
body: IndexCreateParams,
15-
options?: Core.RequestOptions,
16-
): Core.APIPromise<CreateIndex | null> {
17-
return (
18-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes`, {
19-
body,
20-
...options,
21-
}) as Core.APIPromise<{ result: CreateIndex | null }>
22-
)._thenUnwrap((obj) => obj.result);
23-
}
24-
25-
/**
26-
* Updates and returns the specified Vectorize Index.
27-
*/
28-
update(
29-
accountIdentifier: string,
30-
indexName: string,
31-
body: IndexUpdateParams,
32-
options?: Core.RequestOptions,
33-
): Core.APIPromise<CreateIndex | null> {
34-
return (
35-
this._client.put(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}`, {
36-
body,
37-
...options,
38-
}) as Core.APIPromise<{ result: CreateIndex | null }>
39-
)._thenUnwrap((obj) => obj.result);
40-
}
41-
42-
/**
43-
* Returns a list of Vectorize Indexes
44-
*/
45-
list(
46-
accountIdentifier: string,
47-
options?: Core.RequestOptions,
48-
): Core.PagePromise<CreateIndicesSinglePage, CreateIndex> {
49-
return this._client.getAPIList(
50-
`/accounts/${accountIdentifier}/vectorize/indexes`,
51-
CreateIndicesSinglePage,
52-
options,
53-
);
54-
}
55-
56-
/**
57-
* Deletes the specified Vectorize Index.
58-
*/
59-
delete(
60-
accountIdentifier: string,
61-
indexName: string,
62-
options?: Core.RequestOptions,
63-
): Core.APIPromise<IndexDeleteResponse> {
64-
return (
65-
this._client.delete(
66-
`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}`,
67-
options,
68-
) as Core.APIPromise<{ result: IndexDeleteResponse }>
69-
)._thenUnwrap((obj) => obj.result);
70-
}
71-
72-
/**
73-
* Delete a set of vectors from an index by their vector identifiers.
74-
*/
75-
deleteByIds(
76-
accountIdentifier: string,
77-
indexName: string,
78-
body: IndexDeleteByIDsParams,
79-
options?: Core.RequestOptions,
80-
): Core.APIPromise<IndexDeleteVectorsByID | null> {
81-
return (
82-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}/delete-by-ids`, {
83-
body,
84-
...options,
85-
}) as Core.APIPromise<{ result: IndexDeleteVectorsByID | null }>
86-
)._thenUnwrap((obj) => obj.result);
87-
}
88-
89-
/**
90-
* Returns the specified Vectorize Index.
91-
*/
92-
get(
93-
accountIdentifier: string,
94-
indexName: string,
95-
options?: Core.RequestOptions,
96-
): Core.APIPromise<CreateIndex | null> {
97-
return (
98-
this._client.get(
99-
`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}`,
100-
options,
101-
) as Core.APIPromise<{ result: CreateIndex | null }>
102-
)._thenUnwrap((obj) => obj.result);
103-
}
104-
105-
/**
106-
* Get a set of vectors from an index by their vector identifiers.
107-
*/
108-
getByIds(
109-
accountIdentifier: string,
110-
indexName: string,
111-
body: IndexGetByIDsParams,
112-
options?: Core.RequestOptions,
113-
): Core.APIPromise<IndexGetByIDsResponse | null> {
114-
return (
115-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}/get-by-ids`, {
116-
body,
117-
...options,
118-
}) as Core.APIPromise<{ result: IndexGetByIDsResponse | null }>
119-
)._thenUnwrap((obj) => obj.result);
120-
}
121-
122-
/**
123-
* Inserts vectors into the specified index and returns the count of the vectors
124-
* successfully inserted.
125-
*/
126-
insert(
127-
accountIdentifier: string,
128-
indexName: string,
129-
body: IndexInsertParams,
130-
options?: Core.RequestOptions,
131-
): Core.APIPromise<IndexInsert | null> {
132-
return (
133-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}/insert`, {
134-
body,
135-
...options,
136-
}) as Core.APIPromise<{ result: IndexInsert | null }>
137-
)._thenUnwrap((obj) => obj.result);
138-
}
139-
140-
/**
141-
* Finds vectors closest to a given vector in an index.
142-
*/
143-
query(
144-
accountIdentifier: string,
145-
indexName: string,
146-
body: IndexQueryParams,
147-
options?: Core.RequestOptions,
148-
): Core.APIPromise<IndexQuery | null> {
149-
return (
150-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}/query`, {
151-
body,
152-
...options,
153-
}) as Core.APIPromise<{ result: IndexQuery | null }>
154-
)._thenUnwrap((obj) => obj.result);
155-
}
156-
157-
/**
158-
* Upserts vectors into the specified index, creating them if they do not exist and
159-
* returns the count of values and ids successfully inserted.
160-
*/
161-
upsert(
162-
accountIdentifier: string,
163-
indexName: string,
164-
body: IndexUpsertParams,
165-
options?: Core.RequestOptions,
166-
): Core.APIPromise<IndexUpsert | null> {
167-
return (
168-
this._client.post(`/accounts/${accountIdentifier}/vectorize/indexes/${indexName}/upsert`, {
169-
body,
170-
...options,
171-
}) as Core.APIPromise<{ result: IndexUpsert | null }>
172-
)._thenUnwrap((obj) => obj.result);
173-
}
174-
}
175-
176-
export class CreateIndicesSinglePage extends SinglePage<CreateIndex> {}
6+
export class Indexes extends APIResource {}
1777

1788
export interface CreateIndex {
1799
config?: IndexDimensionConfiguration;
@@ -252,14 +82,14 @@ export namespace IndexQuery {
25282
*/
25383
id?: string;
25484

255-
metadata?: unknown;
85+
metadata?: unknown | null;
25686

25787
/**
25888
* The score of the vector according to the index's distance metric
25989
*/
26090
score?: number;
26191

262-
values?: Array<number>;
92+
values?: Array<number> | null;
26393
}
26494
}
26595

@@ -275,103 +105,11 @@ export interface IndexUpsert {
275105
ids?: Array<string>;
276106
}
277107

278-
export type IndexDeleteResponse = unknown | string | null;
279-
280-
/**
281-
* Array of vectors with matching ids.
282-
*/
283-
export type IndexGetByIDsResponse = unknown;
284-
285-
export interface IndexCreateParams {
286-
/**
287-
* Specifies the type of configuration to use for the index.
288-
*/
289-
config: IndexCreateParams.VectorizeIndexPresetConfiguration | IndexDimensionConfiguration;
290-
291-
name: string;
292-
293-
/**
294-
* Specifies the description of the index.
295-
*/
296-
description?: string;
297-
}
298-
299-
export namespace IndexCreateParams {
300-
export interface VectorizeIndexPresetConfiguration {
301-
/**
302-
* Specifies the preset to use for the index.
303-
*/
304-
preset:
305-
| '@cf/baai/bge-small-en-v1.5'
306-
| '@cf/baai/bge-base-en-v1.5'
307-
| '@cf/baai/bge-large-en-v1.5'
308-
| 'openai/text-embedding-ada-002'
309-
| 'cohere/embed-multilingual-v2.0';
310-
}
311-
}
312-
313-
export interface IndexUpdateParams {
314-
/**
315-
* Specifies the description of the index.
316-
*/
317-
description: string;
318-
}
319-
320-
export interface IndexDeleteByIDsParams {
321-
/**
322-
* A list of vector identifiers to delete from the index indicated by the path.
323-
*/
324-
ids?: Array<string>;
325-
}
326-
327-
export interface IndexGetByIDsParams {
328-
/**
329-
* A list of vector identifiers to retrieve from the index indicated by the path.
330-
*/
331-
ids?: Array<string>;
332-
}
333-
334-
export type IndexInsertParams = unknown;
335-
336-
export interface IndexQueryParams {
337-
/**
338-
* Whether to return the metadata associated with the closest vectors.
339-
*/
340-
returnMetadata?: boolean;
341-
342-
/**
343-
* Whether to return the values associated with the closest vectors.
344-
*/
345-
returnValues?: boolean;
346-
347-
/**
348-
* The number of nearest neighbors to find.
349-
*/
350-
topK?: number;
351-
352-
/**
353-
* The search vector that will be used to find the nearest neighbors.
354-
*/
355-
vector?: Array<number>;
356-
}
357-
358-
export type IndexUpsertParams = unknown;
359-
360108
export namespace Indexes {
361109
export import CreateIndex = IndexesAPI.CreateIndex;
362110
export import IndexDeleteVectorsByID = IndexesAPI.IndexDeleteVectorsByID;
363111
export import IndexDimensionConfiguration = IndexesAPI.IndexDimensionConfiguration;
364112
export import IndexInsert = IndexesAPI.IndexInsert;
365113
export import IndexQuery = IndexesAPI.IndexQuery;
366114
export import IndexUpsert = IndexesAPI.IndexUpsert;
367-
export import IndexDeleteResponse = IndexesAPI.IndexDeleteResponse;
368-
export import IndexGetByIDsResponse = IndexesAPI.IndexGetByIDsResponse;
369-
export import CreateIndicesSinglePage = IndexesAPI.CreateIndicesSinglePage;
370-
export import IndexCreateParams = IndexesAPI.IndexCreateParams;
371-
export import IndexUpdateParams = IndexesAPI.IndexUpdateParams;
372-
export import IndexDeleteByIDsParams = IndexesAPI.IndexDeleteByIDsParams;
373-
export import IndexGetByIDsParams = IndexesAPI.IndexGetByIDsParams;
374-
export import IndexInsertParams = IndexesAPI.IndexInsertParams;
375-
export import IndexQueryParams = IndexesAPI.IndexQueryParams;
376-
export import IndexUpsertParams = IndexesAPI.IndexUpsertParams;
377115
}

src/resources/vectorize/vectorize.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,4 @@ export namespace Vectorize {
1515
export import IndexInsert = IndexesAPI.IndexInsert;
1616
export import IndexQuery = IndexesAPI.IndexQuery;
1717
export import IndexUpsert = IndexesAPI.IndexUpsert;
18-
export import IndexDeleteResponse = IndexesAPI.IndexDeleteResponse;
19-
export import IndexGetByIDsResponse = IndexesAPI.IndexGetByIDsResponse;
20-
export import CreateIndicesSinglePage = IndexesAPI.CreateIndicesSinglePage;
21-
export import IndexCreateParams = IndexesAPI.IndexCreateParams;
22-
export import IndexUpdateParams = IndexesAPI.IndexUpdateParams;
23-
export import IndexDeleteByIDsParams = IndexesAPI.IndexDeleteByIDsParams;
24-
export import IndexGetByIDsParams = IndexesAPI.IndexGetByIDsParams;
25-
export import IndexInsertParams = IndexesAPI.IndexInsertParams;
26-
export import IndexQueryParams = IndexesAPI.IndexQueryParams;
27-
export import IndexUpsertParams = IndexesAPI.IndexUpsertParams;
2818
}

0 commit comments

Comments
 (0)