diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c5e8a3e..17473a2 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.2"
+ ".": "0.1.0-alpha.3"
}
diff --git a/.stats.yml b/.stats.yml
index 5b5b50e..d9064ff 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 13
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-79503f9599a8cf36cc6b746114d49c484fc8615cf4d8ef979dc299a88d3045d0.yml
+configured_endpoints: 15
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-99a41bb73e432cb47fe1937219b3c7b109ae534456e8dd019cc00cc1e6018a16.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19c3d3c..88990a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Changelog
+## 0.1.0-alpha.3 (2025-01-28)
+
+Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/zeroentropy-ai/zeroentropy-node/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
+
+### Chores
+
+* go live ([#16](https://github.com/zeroentropy-ai/zeroentropy-node/issues/16)) ([78b6967](https://github.com/zeroentropy-ai/zeroentropy-node/commit/78b6967a40788b16bd97cca17cbbb0d567e298e7))
+* go live ([#18](https://github.com/zeroentropy-ai/zeroentropy-node/issues/18)) ([a0d2514](https://github.com/zeroentropy-ai/zeroentropy-node/commit/a0d2514ae66f0fc6cde76a6da1d05cab7a13ba19))
+* go live ([#19](https://github.com/zeroentropy-ai/zeroentropy-node/issues/19)) ([b0dfe9f](https://github.com/zeroentropy-ai/zeroentropy-node/commit/b0dfe9f277b39876350fe1accee6ec22a9c24e72))
+* trigger release process ([b20b8f3](https://github.com/zeroentropy-ai/zeroentropy-node/commit/b20b8f393f4c3697bb1cfdee7f135a2b39407331))
+
## 0.1.0-alpha.2 (2025-01-18)
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/zeroentropy-ai/zeroentropy-node/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
diff --git a/api.md b/api.md
index 66bdfa7..dc39621 100644
--- a/api.md
+++ b/api.md
@@ -1,3 +1,13 @@
+# Admin
+
+Types:
+
+- AdminCreateOrganizationResponse
+
+Methods:
+
+- client.admin.createOrganization({ ...params }) -> AdminCreateOrganizationResponse
+
# Status
Types:
@@ -26,6 +36,7 @@ Methods:
Types:
+- DocumentUpdateResponse
- DocumentDeleteResponse
- DocumentAddResponse
- DocumentGetInfoResponse
@@ -34,6 +45,7 @@ Types:
Methods:
+- client.documents.update({ ...params }) -> DocumentUpdateResponse
- client.documents.delete({ ...params }) -> DocumentDeleteResponse
- client.documents.add({ ...params }) -> DocumentAddResponse
- client.documents.getInfo({ ...params }) -> DocumentGetInfoResponse
diff --git a/package.json b/package.json
index 2203148..b42e730 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "zeroentropy",
- "version": "0.1.0-alpha.2",
+ "version": "0.1.0-alpha.3",
"description": "The official TypeScript library for the ZeroEntropy API",
"author": "ZeroEntropy ",
"types": "dist/index.d.ts",
diff --git a/src/index.ts b/src/index.ts
index 62e3e54..5fa5cbb 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -7,6 +7,7 @@ import * as Pagination from './pagination';
import { type GetDocumentInfoListCursorParams, GetDocumentInfoListCursorResponse } from './pagination';
import * as Uploads from './uploads';
import * as API from './resources/index';
+import { Admin, AdminCreateOrganizationParams, AdminCreateOrganizationResponse } from './resources/admin';
import {
CollectionAddParams,
CollectionAddResponse,
@@ -28,6 +29,8 @@ import {
DocumentGetInfoResponse,
DocumentGetPageInfoParams,
DocumentGetPageInfoResponse,
+ DocumentUpdateParams,
+ DocumentUpdateResponse,
Documents,
} from './resources/documents';
import { ParserParseDocumentParams, ParserParseDocumentResponse, Parsers } from './resources/parsers';
@@ -155,6 +158,7 @@ export class ZeroEntropy extends Core.APIClient {
this.apiKey = apiKey;
}
+ admin: API.Admin = new API.Admin(this);
status: API.Status = new API.Status(this);
collections: API.Collections = new API.Collections(this);
documents: API.Documents = new API.Documents(this);
@@ -197,6 +201,7 @@ export class ZeroEntropy extends Core.APIClient {
static fileFromPath = Uploads.fileFromPath;
}
+ZeroEntropy.Admin = Admin;
ZeroEntropy.Status = Status;
ZeroEntropy.Collections = Collections;
ZeroEntropy.Documents = Documents;
@@ -213,6 +218,12 @@ export declare namespace ZeroEntropy {
type GetDocumentInfoListCursorResponse as GetDocumentInfoListCursorResponse,
};
+ export {
+ Admin as Admin,
+ type AdminCreateOrganizationResponse as AdminCreateOrganizationResponse,
+ type AdminCreateOrganizationParams as AdminCreateOrganizationParams,
+ };
+
export {
Status as Status,
type StatusGetStatusResponse as StatusGetStatusResponse,
@@ -231,12 +242,14 @@ export declare namespace ZeroEntropy {
export {
Documents as Documents,
+ type DocumentUpdateResponse as DocumentUpdateResponse,
type DocumentDeleteResponse as DocumentDeleteResponse,
type DocumentAddResponse as DocumentAddResponse,
type DocumentGetInfoResponse as DocumentGetInfoResponse,
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
+ type DocumentUpdateParams as DocumentUpdateParams,
type DocumentDeleteParams as DocumentDeleteParams,
type DocumentAddParams as DocumentAddParams,
type DocumentGetInfoParams as DocumentGetInfoParams,
diff --git a/src/resources/admin.ts b/src/resources/admin.ts
new file mode 100644
index 0000000..db3ffa9
--- /dev/null
+++ b/src/resources/admin.ts
@@ -0,0 +1,46 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../resource';
+import * as Core from '../core';
+
+export class Admin extends APIResource {
+ /**
+ * Creates or updates an organization with the provided organization name. An API
+ * Key will be returned.
+ *
+ * Returns 201 if a new organization was created, 200 if an existing organization
+ * was found.
+ */
+ createOrganization(
+ body: AdminCreateOrganizationParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.post('/admin/create-organization', { body, ...options });
+ }
+}
+
+export interface AdminCreateOrganizationResponse {
+ /**
+ * The API Key for this organization.
+ */
+ api_key: string;
+
+ /**
+ * The name of the organization
+ */
+ organization_name: string;
+}
+
+export interface AdminCreateOrganizationParams {
+ /**
+ * The orgniazation name to create. Must be unique.
+ */
+ organization_name: string;
+}
+
+export declare namespace Admin {
+ export {
+ type AdminCreateOrganizationResponse as AdminCreateOrganizationResponse,
+ type AdminCreateOrganizationParams as AdminCreateOrganizationParams,
+ };
+}
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index df5bfd8..cee81ce 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -5,6 +5,25 @@ import * as Core from '../core';
import { GetDocumentInfoListCursor, type GetDocumentInfoListCursorParams } from '../pagination';
export class Documents extends APIResource {
+ /**
+ * Updates a document. This endpoint is atomic.
+ *
+ * The only attribute currently supported for update is `metadata`. This endpoint
+ * can only be called with a non-null `metadata` if the document status is
+ * `indexed`.
+ *
+ * Sometimes, when updating a document, a new document ID will be assigned and the
+ * previous will be deleted. For this reason, the previous and the new document ID
+ * will both be returned in the response. If the document ID was not updated, then
+ * these two IDs will be identical.
+ *
+ * A `404 Not Found` status code will be returned, if the provided collection name
+ * or document path does not exist.
+ */
+ update(body: DocumentUpdateParams, options?: Core.RequestOptions): Core.APIPromise {
+ return this._client.post('/documents/update-document', { body, ...options });
+ }
+
/**
* Deletes a document
*
@@ -86,6 +105,12 @@ export class Documents extends APIResource {
export class DocumentGetInfoListResponsesGetDocumentInfoListCursor extends GetDocumentInfoListCursor {}
+export interface DocumentUpdateResponse {
+ new_id: string;
+
+ previous_id: string;
+}
+
export interface DocumentDeleteResponse {
/**
* This string will always be "Success!". This may change in the future.
@@ -110,7 +135,14 @@ export namespace DocumentGetInfoResponse {
collection_name: string;
- index_status: 'parsing_failed' | 'not_parsed' | 'not_indexed' | 'indexing' | 'indexed';
+ index_status:
+ | 'not_parsed'
+ | 'parsing'
+ | 'not_indexed'
+ | 'indexing'
+ | 'indexed'
+ | 'parsing_failed'
+ | 'indexing_failed';
metadata: Record>;
@@ -135,7 +167,14 @@ export interface DocumentGetInfoListResponse {
collection_name: string;
- index_status: 'parsing_failed' | 'not_parsed' | 'not_indexed' | 'indexing' | 'indexed';
+ index_status:
+ | 'not_parsed'
+ | 'parsing'
+ | 'not_indexed'
+ | 'indexing'
+ | 'indexed'
+ | 'parsing_failed'
+ | 'indexing_failed';
metadata: Record>;
@@ -162,6 +201,14 @@ export namespace DocumentGetPageInfoResponse {
*/
collection_name: string;
+ /**
+ * A URL to an image of the page. This field will only be provided if the document
+ * has finished parsing, and if it is a filetype that is capable of producing
+ * images (e.g. PDF, DOCX, PPT, etc). In all other cases, this field will be
+ * `null`.
+ */
+ image_url: string | null;
+
/**
* The specific page index of this page. Pages are 0-indexed, so that the 1st page
* of a PDF is of page index 0.
@@ -179,18 +226,30 @@ export namespace DocumentGetPageInfoResponse {
* will be set to `null`.
*/
content?: string | null;
-
- /**
- * An image of the page. This will be a base64-encoded string. Currently, this data
- * is guaranteed to be a JPEG-encoded image. This field will only be provided if
- * `include_image` was set to `true`, and the document has finished parsing. Also,
- * the document must be a datatype that supports images (PDF, DOCX, PPT, but not
- * .txt). In all other cases, this field will be `null`.
- */
- image_base64_data?: string | null;
}
}
+export interface DocumentUpdateParams {
+ /**
+ * The name of the collection.
+ */
+ collection_name: string;
+
+ /**
+ * The filepath of the document that you are updating. A `404 Not Found` status
+ * code will be returned if no document with this path was found.
+ */
+ path: string;
+
+ /**
+ * If this field is provided, the given metadata json will replace the document's
+ * existing metadata json. In other words, if you want to add a new field, you will
+ * need to provide the entire metadata object (Both the original fields, and the
+ * new field).
+ */
+ metadata?: Record> | null;
+}
+
export interface DocumentDeleteParams {
/**
* The name of the collection.
@@ -343,17 +402,6 @@ export interface DocumentGetPageInfoParams {
* rather than `null`. This string will contain the full contents of the page.
*/
include_content?: boolean;
-
- /**
- * If `true`, then the response will have the `image_base64_data` attribute be a
- * `string`\*, rather than `null`. This string will contain the image data of the
- * document, as a base64-encoded string. Currently, this data is guaranteed to be a
- * JPEG-encoded image.
- *
- * \*Note that the response may still be `null`, if the page has no image data,
- * such as if the document was uploaded with raw text rather than as a PDF.
- */
- include_image?: boolean;
}
Documents.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
@@ -361,12 +409,14 @@ Documents.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
export declare namespace Documents {
export {
+ type DocumentUpdateResponse as DocumentUpdateResponse,
type DocumentDeleteResponse as DocumentDeleteResponse,
type DocumentAddResponse as DocumentAddResponse,
type DocumentGetInfoResponse as DocumentGetInfoResponse,
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
+ type DocumentUpdateParams as DocumentUpdateParams,
type DocumentDeleteParams as DocumentDeleteParams,
type DocumentAddParams as DocumentAddParams,
type DocumentGetInfoParams as DocumentGetInfoParams,
diff --git a/src/resources/index.ts b/src/resources/index.ts
index c55bd6f..46063e4 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,5 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+export { Admin, type AdminCreateOrganizationResponse, type AdminCreateOrganizationParams } from './admin';
export {
Collections,
type CollectionDeleteResponse,
@@ -12,11 +13,13 @@ export {
export {
DocumentGetInfoListResponsesGetDocumentInfoListCursor,
Documents,
+ type DocumentUpdateResponse,
type DocumentDeleteResponse,
type DocumentAddResponse,
type DocumentGetInfoResponse,
type DocumentGetInfoListResponse,
type DocumentGetPageInfoResponse,
+ type DocumentUpdateParams,
type DocumentDeleteParams,
type DocumentAddParams,
type DocumentGetInfoParams,
diff --git a/src/resources/queries.ts b/src/resources/queries.ts
index a339b70..890e4fe 100644
--- a/src/resources/queries.ts
+++ b/src/resources/queries.ts
@@ -74,6 +74,14 @@ export namespace QueryTopPagesResponse {
*/
content: string | null;
+ /**
+ * A URL to an image of the page. This field will only be provided if the document
+ * has finished parsing, and if it is a filetype that is capable of producing
+ * images (e.g. PDF, DOCX, PPT, etc). In all other cases, this field will be
+ * `null`.
+ */
+ image_url: string | null;
+
/**
* The index of this page in the document. This field is 0-indexed. So, the 1st
* page has index 0, and the 2nd page has index 1.
@@ -169,6 +177,15 @@ export interface QueryTopDocumentsParams {
* provided, then the default will be `False`.
*/
include_metadata?: boolean;
+
+ /**
+ * This option selects between our two latency modes. The higher latency mode takes
+ * longer, but can allow for more accurate responses. If desired, test both to
+ * customize your search experience for your particular use-case, or use the
+ * default of "low" and only swap if you need an additional improvement in search
+ * result quality.
+ */
+ latency_mode?: 'low' | 'high';
}
export interface QueryTopPagesParams {
@@ -200,6 +217,15 @@ export interface QueryTopPagesParams {
* If set to true, then the content of all pages will be returned.
*/
include_content?: boolean;
+
+ /**
+ * This option selects between our two latency modes. The higher latency mode takes
+ * longer, but can allow for more accurate responses. If desired, test both to
+ * customize your search experience for your particular use-case, or use the
+ * default of "low" and only swap if you need an additional improvement in search
+ * result quality.
+ */
+ latency_mode?: 'low' | 'high';
}
export interface QueryTopSnippetsParams {
@@ -227,6 +253,15 @@ export interface QueryTopSnippetsParams {
*/
filter?: Record | null;
+ /**
+ * Note that for Top K Snippets, only latency_mode "low" is available. This option
+ * selects between our latency modes. The higher latency mode takes longer, but can
+ * allow for more accurate responses. If desired, test both to customize your
+ * search experience for your particular use-case, or use the default of "low" and
+ * only swap if you need an additional improvement in search result quality.
+ */
+ latency_mode?: 'low';
+
/**
* Enable precise responses. Precise responses will have higher latency, but
* provide much more precise snippets. When `precise_responses` is set to `true`,
diff --git a/src/version.ts b/src/version.ts
index a528f63..a64b06c 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.1.0-alpha.2'; // x-release-please-version
+export const VERSION = '0.1.0-alpha.3'; // x-release-please-version
diff --git a/tests/api-resources/admin.test.ts b/tests/api-resources/admin.test.ts
new file mode 100644
index 0000000..f5f7892
--- /dev/null
+++ b/tests/api-resources/admin.test.ts
@@ -0,0 +1,26 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import ZeroEntropy from 'zeroentropy';
+import { Response } from 'node-fetch';
+
+const client = new ZeroEntropy({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource admin', () => {
+ test('createOrganization: only required params', async () => {
+ const responsePromise = client.admin.createOrganization({ organization_name: 'organization_name' });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('createOrganization: required and optional params', async () => {
+ const response = await client.admin.createOrganization({ organization_name: 'organization_name' });
+ });
+});
diff --git a/tests/api-resources/documents.test.ts b/tests/api-resources/documents.test.ts
index 56e9852..d27758e 100644
--- a/tests/api-resources/documents.test.ts
+++ b/tests/api-resources/documents.test.ts
@@ -9,6 +9,25 @@ const client = new ZeroEntropy({
});
describe('resource documents', () => {
+ test('update: only required params', async () => {
+ const responsePromise = client.documents.update({ collection_name: 'collection_name', path: 'path' });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('update: required and optional params', async () => {
+ const response = await client.documents.update({
+ collection_name: 'collection_name',
+ path: 'path',
+ metadata: { foo: 'string' },
+ });
+ });
+
test('delete: only required params', async () => {
const responsePromise = client.documents.delete({ collection_name: 'collection_name', path: 'path' });
const rawResponse = await responsePromise.asResponse();
@@ -108,7 +127,6 @@ describe('resource documents', () => {
page_index: 0,
path: 'path',
include_content: true,
- include_image: true,
});
});
});
diff --git a/tests/api-resources/queries.test.ts b/tests/api-resources/queries.test.ts
index 60465af..811e940 100644
--- a/tests/api-resources/queries.test.ts
+++ b/tests/api-resources/queries.test.ts
@@ -31,6 +31,7 @@ describe('resource queries', () => {
query: 'query',
filter: { foo: 'bar' },
include_metadata: true,
+ latency_mode: 'low',
});
});
@@ -56,6 +57,7 @@ describe('resource queries', () => {
query: 'query',
filter: { foo: 'bar' },
include_content: true,
+ latency_mode: 'low',
});
});
@@ -80,6 +82,7 @@ describe('resource queries', () => {
k: 0,
query: 'query',
filter: { foo: 'bar' },
+ latency_mode: 'low',
precise_responses: true,
});
});
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 5d83fd1..181fe3c 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -96,6 +96,15 @@ describe('instantiate client', () => {
expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true });
});
+ test('explicit global fetch', async () => {
+ // make sure the global fetch type is assignable to our Fetch type
+ const client = new ZeroEntropy({
+ baseURL: 'http://localhost:5000/',
+ apiKey: 'My API Key',
+ fetch: defaultFetch,
+ });
+ });
+
test('custom signal', async () => {
const client = new ZeroEntropy({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',