Skip to content

Commit f7feded

Browse files
chore: go live (#16)
1 parent 7894369 commit f7feded

File tree

14 files changed

+243
-28
lines changed

14 files changed

+243
-28
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.1"
2+
".": "0.1.0-alpha.2"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 13
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-79503f9599a8cf36cc6b746114d49c484fc8615cf4d8ef979dc299a88d3045d0.yml
1+
configured_endpoints: 15
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-99a41bb73e432cb47fe1937219b3c7b109ae534456e8dd019cc00cc1e6018a16.yml

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Admin
2+
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+
111
# Status
212

313
Types:
@@ -26,6 +36,7 @@ Methods:
2636

2737
Types:
2838

39+
- <code><a href="./src/resources/documents.ts">DocumentUpdateResponse</a></code>
2940
- <code><a href="./src/resources/documents.ts">DocumentDeleteResponse</a></code>
3041
- <code><a href="./src/resources/documents.ts">DocumentAddResponse</a></code>
3142
- <code><a href="./src/resources/documents.ts">DocumentGetInfoResponse</a></code>
@@ -34,6 +45,7 @@ Types:
3445

3546
Methods:
3647

48+
- <code title="post /documents/update-document">client.documents.<a href="./src/resources/documents.ts">update</a>({ ...params }) -> DocumentUpdateResponse</code>
3749
- <code title="post /documents/delete-document">client.documents.<a href="./src/resources/documents.ts">delete</a>({ ...params }) -> DocumentDeleteResponse</code>
3850
- <code title="post /documents/add-document">client.documents.<a href="./src/resources/documents.ts">add</a>({ ...params }) -> DocumentAddResponse</code>
3951
- <code title="post /documents/get-document-info">client.documents.<a href="./src/resources/documents.ts">getInfo</a>({ ...params }) -> DocumentGetInfoResponse</code>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zeroentropy",
3-
"version": "0.1.0-alpha.1",
3+
"version": "0.1.0-alpha.2",
44
"description": "The official TypeScript library for the ZeroEntropy API",
55
"author": "ZeroEntropy <[email protected]>",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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';
1011
import {
1112
CollectionAddParams,
1213
CollectionAddResponse,
@@ -28,6 +29,8 @@ import {
2829
DocumentGetInfoResponse,
2930
DocumentGetPageInfoParams,
3031
DocumentGetPageInfoResponse,
32+
DocumentUpdateParams,
33+
DocumentUpdateResponse,
3134
Documents,
3235
} from './resources/documents';
3336
import { ParserParseDocumentParams, ParserParseDocumentResponse, Parsers } from './resources/parsers';
@@ -155,6 +158,7 @@ export class ZeroEntropy extends Core.APIClient {
155158
this.apiKey = apiKey;
156159
}
157160

161+
admin: API.Admin = new API.Admin(this);
158162
status: API.Status = new API.Status(this);
159163
collections: API.Collections = new API.Collections(this);
160164
documents: API.Documents = new API.Documents(this);
@@ -197,6 +201,7 @@ export class ZeroEntropy extends Core.APIClient {
197201
static fileFromPath = Uploads.fileFromPath;
198202
}
199203

204+
ZeroEntropy.Admin = Admin;
200205
ZeroEntropy.Status = Status;
201206
ZeroEntropy.Collections = Collections;
202207
ZeroEntropy.Documents = Documents;
@@ -213,6 +218,12 @@ export declare namespace ZeroEntropy {
213218
type GetDocumentInfoListCursorResponse as GetDocumentInfoListCursorResponse,
214219
};
215220

221+
export {
222+
Admin as Admin,
223+
type AdminCreateOrganizationResponse as AdminCreateOrganizationResponse,
224+
type AdminCreateOrganizationParams as AdminCreateOrganizationParams,
225+
};
226+
216227
export {
217228
Status as Status,
218229
type StatusGetStatusResponse as StatusGetStatusResponse,
@@ -231,12 +242,14 @@ export declare namespace ZeroEntropy {
231242

232243
export {
233244
Documents as Documents,
245+
type DocumentUpdateResponse as DocumentUpdateResponse,
234246
type DocumentDeleteResponse as DocumentDeleteResponse,
235247
type DocumentAddResponse as DocumentAddResponse,
236248
type DocumentGetInfoResponse as DocumentGetInfoResponse,
237249
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
238250
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
239251
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
252+
type DocumentUpdateParams as DocumentUpdateParams,
240253
type DocumentDeleteParams as DocumentDeleteParams,
241254
type DocumentAddParams as DocumentAddParams,
242255
type DocumentGetInfoParams as DocumentGetInfoParams,

src/resources/admin.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../resource';
4+
import * as Core from '../core';
5+
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+
}

src/resources/documents.ts

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ import * as Core from '../core';
55
import { GetDocumentInfoListCursor, type GetDocumentInfoListCursorParams } from '../pagination';
66

77
export class Documents extends APIResource {
8+
/**
9+
* Updates a document. This endpoint is atomic.
10+
*
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`.
14+
*
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.
19+
*
20+
* A `404 Not Found` status code will be returned, if the provided collection name
21+
* or document path does not exist.
22+
*/
23+
update(body: DocumentUpdateParams, options?: Core.RequestOptions): Core.APIPromise<DocumentUpdateResponse> {
24+
return this._client.post('/documents/update-document', { body, ...options });
25+
}
26+
827
/**
928
* Deletes a document
1029
*
@@ -86,6 +105,12 @@ export class Documents extends APIResource {
86105

87106
export class DocumentGetInfoListResponsesGetDocumentInfoListCursor extends GetDocumentInfoListCursor<DocumentGetInfoListResponse> {}
88107

108+
export interface DocumentUpdateResponse {
109+
new_id: string;
110+
111+
previous_id: string;
112+
}
113+
89114
export interface DocumentDeleteResponse {
90115
/**
91116
* This string will always be "Success!". This may change in the future.
@@ -110,7 +135,14 @@ export namespace DocumentGetInfoResponse {
110135

111136
collection_name: string;
112137

113-
index_status: 'parsing_failed' | 'not_parsed' | 'not_indexed' | 'indexing' | 'indexed';
138+
index_status:
139+
| 'not_parsed'
140+
| 'parsing'
141+
| 'not_indexed'
142+
| 'indexing'
143+
| 'indexed'
144+
| 'parsing_failed'
145+
| 'indexing_failed';
114146

115147
metadata: Record<string, string | Array<string>>;
116148

@@ -135,7 +167,14 @@ export interface DocumentGetInfoListResponse {
135167

136168
collection_name: string;
137169

138-
index_status: 'parsing_failed' | 'not_parsed' | 'not_indexed' | 'indexing' | 'indexed';
170+
index_status:
171+
| 'not_parsed'
172+
| 'parsing'
173+
| 'not_indexed'
174+
| 'indexing'
175+
| 'indexed'
176+
| 'parsing_failed'
177+
| 'indexing_failed';
139178

140179
metadata: Record<string, string | Array<string>>;
141180

@@ -162,6 +201,14 @@ export namespace DocumentGetPageInfoResponse {
162201
*/
163202
collection_name: string;
164203

204+
/**
205+
* A URL to an image of the page. This field will only be provided if the document
206+
* has finished parsing, and if it is a filetype that is capable of producing
207+
* images (e.g. PDF, DOCX, PPT, etc). In all other cases, this field will be
208+
* `null`.
209+
*/
210+
image_url: string | null;
211+
165212
/**
166213
* The specific page index of this page. Pages are 0-indexed, so that the 1st page
167214
* of a PDF is of page index 0.
@@ -179,18 +226,30 @@ export namespace DocumentGetPageInfoResponse {
179226
* will be set to `null`.
180227
*/
181228
content?: string | null;
182-
183-
/**
184-
* An image of the page. This will be a base64-encoded string. Currently, this data
185-
* is guaranteed to be a JPEG-encoded image. This field will only be provided if
186-
* `include_image` was set to `true`, and the document has finished parsing. Also,
187-
* the document must be a datatype that supports images (PDF, DOCX, PPT, but not
188-
* .txt). In all other cases, this field will be `null`.
189-
*/
190-
image_base64_data?: string | null;
191229
}
192230
}
193231

232+
export interface DocumentUpdateParams {
233+
/**
234+
* The name of the collection.
235+
*/
236+
collection_name: string;
237+
238+
/**
239+
* The filepath of the document that you are updating. A `404 Not Found` status
240+
* code will be returned if no document with this path was found.
241+
*/
242+
path: string;
243+
244+
/**
245+
* If this field is provided, the given metadata json will replace the document's
246+
* existing metadata json. In other words, if you want to add a new field, you will
247+
* need to provide the entire metadata object (Both the original fields, and the
248+
* new field).
249+
*/
250+
metadata?: Record<string, string | Array<string>> | null;
251+
}
252+
194253
export interface DocumentDeleteParams {
195254
/**
196255
* The name of the collection.
@@ -343,30 +402,21 @@ export interface DocumentGetPageInfoParams {
343402
* rather than `null`. This string will contain the full contents of the page.
344403
*/
345404
include_content?: boolean;
346-
347-
/**
348-
* If `true`, then the response will have the `image_base64_data` attribute be a
349-
* `string`\*, rather than `null`. This string will contain the image data of the
350-
* document, as a base64-encoded string. Currently, this data is guaranteed to be a
351-
* JPEG-encoded image.
352-
*
353-
* \*Note that the response may still be `null`, if the page has no image data,
354-
* such as if the document was uploaded with raw text rather than as a PDF.
355-
*/
356-
include_image?: boolean;
357405
}
358406

359407
Documents.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
360408
DocumentGetInfoListResponsesGetDocumentInfoListCursor;
361409

362410
export declare namespace Documents {
363411
export {
412+
type DocumentUpdateResponse as DocumentUpdateResponse,
364413
type DocumentDeleteResponse as DocumentDeleteResponse,
365414
type DocumentAddResponse as DocumentAddResponse,
366415
type DocumentGetInfoResponse as DocumentGetInfoResponse,
367416
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
368417
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
369418
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
419+
type DocumentUpdateParams as DocumentUpdateParams,
370420
type DocumentDeleteParams as DocumentDeleteParams,
371421
type DocumentAddParams as DocumentAddParams,
372422
type DocumentGetInfoParams as DocumentGetInfoParams,

src/resources/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +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';
34
export {
45
Collections,
56
type CollectionDeleteResponse,
@@ -12,11 +13,13 @@ export {
1213
export {
1314
DocumentGetInfoListResponsesGetDocumentInfoListCursor,
1415
Documents,
16+
type DocumentUpdateResponse,
1517
type DocumentDeleteResponse,
1618
type DocumentAddResponse,
1719
type DocumentGetInfoResponse,
1820
type DocumentGetInfoListResponse,
1921
type DocumentGetPageInfoResponse,
22+
type DocumentUpdateParams,
2023
type DocumentDeleteParams,
2124
type DocumentAddParams,
2225
type DocumentGetInfoParams,

src/resources/queries.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ export namespace QueryTopPagesResponse {
7474
*/
7575
content: string | null;
7676

77+
/**
78+
* A URL to an image of the page. This field will only be provided if the document
79+
* has finished parsing, and if it is a filetype that is capable of producing
80+
* images (e.g. PDF, DOCX, PPT, etc). In all other cases, this field will be
81+
* `null`.
82+
*/
83+
image_url: string | null;
84+
7785
/**
7886
* The index of this page in the document. This field is 0-indexed. So, the 1st
7987
* page has index 0, and the 2nd page has index 1.
@@ -169,6 +177,15 @@ export interface QueryTopDocumentsParams {
169177
* provided, then the default will be `False`.
170178
*/
171179
include_metadata?: boolean;
180+
181+
/**
182+
* This option selects between our two latency modes. The higher latency mode takes
183+
* longer, but can allow for more accurate responses. If desired, test both to
184+
* customize your search experience for your particular use-case, or use the
185+
* default of "low" and only swap if you need an additional improvement in search
186+
* result quality.
187+
*/
188+
latency_mode?: 'low' | 'high';
172189
}
173190

174191
export interface QueryTopPagesParams {
@@ -200,6 +217,15 @@ export interface QueryTopPagesParams {
200217
* If set to true, then the content of all pages will be returned.
201218
*/
202219
include_content?: boolean;
220+
221+
/**
222+
* This option selects between our two latency modes. The higher latency mode takes
223+
* longer, but can allow for more accurate responses. If desired, test both to
224+
* customize your search experience for your particular use-case, or use the
225+
* default of "low" and only swap if you need an additional improvement in search
226+
* result quality.
227+
*/
228+
latency_mode?: 'low' | 'high';
203229
}
204230

205231
export interface QueryTopSnippetsParams {
@@ -227,6 +253,15 @@ export interface QueryTopSnippetsParams {
227253
*/
228254
filter?: Record<string, unknown> | null;
229255

256+
/**
257+
* Note that for Top K Snippets, only latency_mode "low" is available. This option
258+
* selects between our latency modes. The higher latency mode takes longer, but can
259+
* allow for more accurate responses. If desired, test both to customize your
260+
* search experience for your particular use-case, or use the default of "low" and
261+
* only swap if you need an additional improvement in search result quality.
262+
*/
263+
latency_mode?: 'low';
264+
230265
/**
231266
* Enable precise responses. Precise responses will have higher latency, but
232267
* provide much more precise snippets. When `precise_responses` is set to `true`,

0 commit comments

Comments
 (0)