Skip to content

Commit 15ace1c

Browse files
feat(api): manual updates
1 parent 1a1ff44 commit 15ace1c

File tree

10 files changed

+50
-114
lines changed

10 files changed

+50
-114
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-f06c49dfd4b38a4f9d5bcad56348156bbf641aa8b7968acfbf655ad6ceff2126.yml
3-
openapi_spec_hash: cac52dd65fbcb65ffa7a183e764b7f06
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-bd2f55f423e09b74f83cbad6034fb76f7052363308d02533a908b49543cff459.yml
3+
openapi_spec_hash: 6d7566ebda7fecac4069744949d547e0
44
config_hash: beba80a17ba64c5439712e85129ab5ad

api.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# Admin
22

3-
Types:
4-
5-
- <code><a href="./src/resources/admin.ts">AdminCreateOrganizationResponse</a></code>
6-
7-
Methods:
8-
9-
- <code title="post /admin/create-organization">client.admin.<a href="./src/resources/admin.ts">createOrganization</a>({ ...params }) -> AdminCreateOrganizationResponse</code>
10-
113
# Status
124

135
Types:

src/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as Pagination from './pagination';
77
import { type GetDocumentInfoListCursorParams, GetDocumentInfoListCursorResponse } from './pagination';
88
import * as Uploads from './uploads';
99
import * as API from './resources/index';
10-
import { Admin, AdminCreateOrganizationParams, AdminCreateOrganizationResponse } from './resources/admin';
10+
import { Admin } from './resources/admin';
1111
import {
1212
CollectionAddParams,
1313
CollectionAddResponse,
@@ -228,11 +228,7 @@ export declare namespace ZeroEntropy {
228228
type GetDocumentInfoListCursorResponse as GetDocumentInfoListCursorResponse,
229229
};
230230

231-
export {
232-
Admin as Admin,
233-
type AdminCreateOrganizationResponse as AdminCreateOrganizationResponse,
234-
type AdminCreateOrganizationParams as AdminCreateOrganizationParams,
235-
};
231+
export { Admin as Admin };
236232

237233
export {
238234
Status as Status,

src/resources/admin.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../resource';
4-
import * as Core from '../core';
54

6-
export class Admin extends APIResource {
7-
/**
8-
* Creates or updates an organization with the provided organization name. An API
9-
* Key will be returned.
10-
*
11-
* Returns 201 if a new organization was created, 200 if an existing organization
12-
* was found.
13-
*/
14-
createOrganization(
15-
body: AdminCreateOrganizationParams,
16-
options?: Core.RequestOptions,
17-
): Core.APIPromise<AdminCreateOrganizationResponse> {
18-
return this._client.post('/admin/create-organization', { body, ...options });
19-
}
20-
}
21-
22-
export interface AdminCreateOrganizationResponse {
23-
/**
24-
* The API Key for this organization.
25-
*/
26-
api_key: string;
27-
28-
/**
29-
* The name of the organization
30-
*/
31-
organization_name: string;
32-
}
33-
34-
export interface AdminCreateOrganizationParams {
35-
/**
36-
* The orgniazation name to create. Must be unique.
37-
*/
38-
organization_name: string;
39-
}
40-
41-
export declare namespace Admin {
42-
export {
43-
type AdminCreateOrganizationResponse as AdminCreateOrganizationResponse,
44-
type AdminCreateOrganizationParams as AdminCreateOrganizationParams,
45-
};
46-
}
5+
export class Admin extends APIResource {}

src/resources/documents.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ export class Documents extends APIResource {
88
/**
99
* Updates a document. This endpoint is atomic.
1010
*
11-
* The only attribute currently supported for update is `metadata`. This endpoint
12-
* can only be called with a non-null `metadata` if the document status is
13-
* `indexed`.
11+
* Currently both `metadata` and `index_status` are supported.
1412
*
15-
* Sometimes, when updating a document, a new document ID will be assigned and the
16-
* previous will be deleted. For this reason, the previous and the new document ID
17-
* will both be returned in the response. If the document ID was not updated, then
18-
* these two IDs will be identical.
13+
* - When updating with a non-null `metadata`, the document must have
14+
* `index_status` of `indexed`. After this call, the document will have an
15+
* `index_status` of `not_indexed`, since the document will need to reindex with
16+
* the new metadata.
17+
* - When updating with a non-null `index_status`, setting it to
18+
* `not_parsed or `not_indexed`requires that the document must have`index_status`of`parsing_failed`or`indexing_failed`,
19+
* respectively.
1920
*
2021
* A `404 Not Found` status code will be returned, if the provided collection name
2122
* or document path does not exist.
@@ -106,9 +107,10 @@ export class Documents extends APIResource {
106107
export class DocumentGetInfoListResponsesGetDocumentInfoListCursor extends GetDocumentInfoListCursor<DocumentGetInfoListResponse> {}
107108

108109
export interface DocumentUpdateResponse {
109-
new_id: string;
110-
111-
previous_id: string;
110+
/**
111+
* This string will always be "Success!". This may change in the future.
112+
*/
113+
message?: string;
112114
}
113115

114116
export interface DocumentDeleteResponse {
@@ -274,6 +276,14 @@ export interface DocumentUpdateParams {
274276
*/
275277
path: string;
276278

279+
/**
280+
* If the document is in the index_status of
281+
* `parsing_failed or `indexing_failed`, then this endpoint allows you to update the index status to `not_parsed`and`not_indexed`,
282+
* respectively. This allows the document to re-attempt to parse/index after
283+
* failure.
284+
*/
285+
index_status?: 'not_parsed' | 'not_indexed' | null;
286+
277287
/**
278288
* If this field is provided, the given metadata json will replace the document's
279289
* existing metadata json. In other words, if you want to add a new field, you will

src/resources/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export { Admin, type AdminCreateOrganizationResponse, type AdminCreateOrganizationParams } from './admin';
3+
export { Admin } from './admin';
44
export {
55
Collections,
66
type CollectionDeleteResponse,

src/resources/queries.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ export namespace QueryTopSnippetsResponse {
168168
*/
169169
export interface Result {
170170
/**
171-
* If requested, this contains the full string content of this snippet.
171+
* The full string content of this snippet.
172172
*/
173-
content: string | null;
173+
content: string;
174174

175175
/**
176176
* The end index of this snippet.
@@ -214,8 +214,7 @@ export interface QueryTopDocumentsParams {
214214
k: number;
215215

216216
/**
217-
* The natural language query to search with. This cannot exceed 4096 characters (A
218-
* single UTF-8 codepoint, is considered to be 1 character).
217+
* The natural language query to search with. This cannot exceed 4096 UTF-8 bytes.
219218
*/
220219
query: string;
221220

@@ -239,6 +238,13 @@ export interface QueryTopDocumentsParams {
239238
* result quality.
240239
*/
241240
latency_mode?: 'low' | 'high';
241+
242+
/**
243+
* The reranker to use after initial retrieval. The default is `null`. You can find
244+
* available model ids along with more information at
245+
* [/models/rerank](/api-reference/models/rerank).
246+
*/
247+
reranker?: string | null;
242248
}
243249

244250
export interface QueryTopPagesParams {
@@ -249,14 +255,13 @@ export interface QueryTopPagesParams {
249255

250256
/**
251257
* The number of pages to return. If there are not enough pages matching your
252-
* filters, then fewer may be returned. This number must be between 1 and 2048,
258+
* filters, then fewer may be returned. This number must be between 1 and 1024,
253259
* inclusive.
254260
*/
255261
k: number;
256262

257263
/**
258-
* The natural language query to search with. This cannot exceed 4096 characters (A
259-
* single UTF-8 codepoint, is considered to be 1 character).
264+
* The natural language query to search with. This cannot exceed 4096 UTF-8 bytes.
260265
*/
261266
query: string;
262267

@@ -289,7 +294,7 @@ export interface QueryTopSnippetsParams {
289294

290295
/**
291296
* The number of snippets to return. If there are not enough snippets matching your
292-
* filters, then fewer may be returned. This number must be between 1 and 2048,
297+
* filters, then fewer may be returned. This number must be between 1 and 128,
293298
* inclusive.
294299
*/
295300
k: number;
@@ -313,22 +318,20 @@ export interface QueryTopSnippetsParams {
313318
*/
314319
include_document_metadata?: boolean;
315320

316-
/**
317-
* Note that for Top K Snippets, only latency_mode "low" is available. This option
318-
* selects between our latency modes. The higher latency mode takes longer, but can
319-
* allow for more accurate responses. If desired, test both to customize your
320-
* search experience for your particular use-case, or use the default of "low" and
321-
* only swap if you need an additional improvement in search result quality.
322-
*/
323-
latency_mode?: 'low';
324-
325321
/**
326322
* Enable precise responses. Precise responses will have higher latency, but
327323
* provide much more precise snippets. When `precise_responses` is set to `true`,
328324
* the responses will average 200 characters. If set to `false`, the responses will
329325
* average 2000 characters. The default is `false`.
330326
*/
331327
precise_responses?: boolean;
328+
329+
/**
330+
* The reranker to use after initial retrieval. The default is `null`. You can find
331+
* available model ids, along with more information, at
332+
* [/models/rerank](/api-reference/models/rerank).
333+
*/
334+
reranker?: string | null;
332335
}
333336

334337
export declare namespace Queries {

tests/api-resources/admin.test.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/api-resources/documents.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe('resource documents', () => {
2424
const response = await client.documents.update({
2525
collection_name: 'collection_name',
2626
path: 'path',
27+
index_status: 'not_parsed',
2728
metadata: { foo: 'string' },
2829
});
2930
});

tests/api-resources/queries.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('resource queries', () => {
3232
filter: { foo: 'bar' },
3333
include_metadata: true,
3434
latency_mode: 'low',
35+
reranker: 'reranker',
3536
});
3637
});
3738

@@ -83,8 +84,8 @@ describe('resource queries', () => {
8384
query: 'query',
8485
filter: { foo: 'bar' },
8586
include_document_metadata: true,
86-
latency_mode: 'low',
8787
precise_responses: true,
88+
reranker: 'reranker',
8889
});
8990
});
9091
});

0 commit comments

Comments
 (0)