Skip to content

Commit 9a6e616

Browse files
feat(api): manual updates
1 parent 628fbde commit 9a6e616

File tree

8 files changed

+93
-70
lines changed

8 files changed

+93
-70
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: 15
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zeroentropy%2Fzeroentropy-bd2f55f423e09b74f83cbad6034fb76f7052363308d02533a908b49543cff459.yml
33
openapi_spec_hash: 6d7566ebda7fecac4069744949d547e0
4-
config_hash: bad49a5f0d0d03ed67d97a3adc3e00d6
4+
config_hash: caf27ab1a3f299029223b3e75a80c9df

api.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,18 @@ Methods:
6060

6161
Types:
6262

63-
- <code><a href="./src/resources/models.ts">ModelParseDocumentResponse</a></code>
6463
- <code><a href="./src/resources/models.ts">ModelRerankResponse</a></code>
6564

6665
Methods:
6766

68-
- <code title="post /parsers/parse-document">client.models.<a href="./src/resources/models.ts">parseDocument</a>({ ...params }) -> ModelParseDocumentResponse</code>
6967
- <code title="post /models/rerank">client.models.<a href="./src/resources/models.ts">rerank</a>({ ...params }) -> ModelRerankResponse</code>
68+
69+
# Parsers
70+
71+
Types:
72+
73+
- <code><a href="./src/resources/parsers.ts">ParserParseDocumentResponse</a></code>
74+
75+
Methods:
76+
77+
- <code title="post /parsers/parse-document">client.parsers.<a href="./src/resources/parsers.ts">parseDocument</a>({ ...params }) -> ParserParseDocumentResponse</code>

src/index.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ import {
3232
DocumentUpdateResponse,
3333
Documents,
3434
} from './resources/documents';
35-
import {
36-
ModelParseDocumentParams,
37-
ModelParseDocumentResponse,
38-
ModelRerankParams,
39-
ModelRerankResponse,
40-
Models,
41-
} from './resources/models';
35+
import { ModelRerankParams, ModelRerankResponse, Models } from './resources/models';
36+
import { ParserParseDocumentParams, ParserParseDocumentResponse, Parsers } from './resources/parsers';
4237
import {
4338
Queries,
4439
QueryTopDocumentsParams,
@@ -171,6 +166,7 @@ export class ZeroEntropy extends Core.APIClient {
171166
documents: API.Documents = new API.Documents(this);
172167
queries: API.Queries = new API.Queries(this);
173168
models: API.Models = new API.Models(this);
169+
parsers: API.Parsers = new API.Parsers(this);
174170

175171
/**
176172
* Check whether the base URL is set to its default.
@@ -222,6 +218,7 @@ ZeroEntropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
222218
DocumentGetInfoListResponsesGetDocumentInfoListCursor;
223219
ZeroEntropy.Queries = Queries;
224220
ZeroEntropy.Models = Models;
221+
ZeroEntropy.Parsers = Parsers;
225222
export declare namespace ZeroEntropy {
226223
export type RequestOptions = Core.RequestOptions;
227224

@@ -276,11 +273,15 @@ export declare namespace ZeroEntropy {
276273

277274
export {
278275
Models as Models,
279-
type ModelParseDocumentResponse as ModelParseDocumentResponse,
280276
type ModelRerankResponse as ModelRerankResponse,
281-
type ModelParseDocumentParams as ModelParseDocumentParams,
282277
type ModelRerankParams as ModelRerankParams,
283278
};
279+
280+
export {
281+
Parsers as Parsers,
282+
type ParserParseDocumentResponse as ParserParseDocumentResponse,
283+
type ParserParseDocumentParams as ParserParseDocumentParams,
284+
};
284285
}
285286

286287
export { toFile, fileFromPath } from './uploads';

src/resources/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ export {
2525
type DocumentGetInfoListParams,
2626
type DocumentGetPageInfoParams,
2727
} from './documents';
28-
export {
29-
Models,
30-
type ModelParseDocumentResponse,
31-
type ModelRerankResponse,
32-
type ModelParseDocumentParams,
33-
type ModelRerankParams,
34-
} from './models';
28+
export { Models, type ModelRerankResponse, type ModelRerankParams } from './models';
29+
export { Parsers, type ParserParseDocumentResponse, type ParserParseDocumentParams } from './parsers';
3530
export {
3631
Queries,
3732
type QueryTopDocumentsResponse,

src/resources/models.ts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,6 @@ import { APIResource } from '../resource';
44
import * as Core from '../core';
55

66
export class Models extends APIResource {
7-
/**
8-
* This provides access to the parsers that we use for indexing. This endpoint will
9-
* not access any collection or search index, and the result will not be saved.
10-
* This will use the same parsing method as the `/documents/add-document` endpoint.
11-
*
12-
* A common use-case for this endpoint, is to use our parser in combination with
13-
* your own pre-processing step, before then uploading it to the search index using
14-
* the `text-pages` filetype.
15-
*/
16-
parseDocument(
17-
body: ModelParseDocumentParams,
18-
options?: Core.RequestOptions,
19-
): Core.APIPromise<ModelParseDocumentResponse> {
20-
return this._client.post('/parsers/parse-document', { body, ...options });
21-
}
22-
237
/**
248
* Reranks the provided documents, according to the provided query.
259
*
@@ -34,13 +18,6 @@ export class Models extends APIResource {
3418
}
3519
}
3620

37-
export interface ModelParseDocumentResponse {
38-
/**
39-
* The parsed pages. Each string will contain the full contents of a page.
40-
*/
41-
pages: Array<string>;
42-
}
43-
4421
export interface ModelRerankResponse {
4522
/**
4623
* The results, ordered by descending order of relevance to the query.
@@ -66,13 +43,6 @@ export namespace ModelRerankResponse {
6643
}
6744
}
6845

69-
export interface ModelParseDocumentParams {
70-
/**
71-
* The document's raw data, as a base64-encoded string
72-
*/
73-
base64_data: string;
74-
}
75-
7646
export interface ModelRerankParams {
7747
/**
7848
* The list of documents to rerank. Each document is a string.
@@ -98,10 +68,5 @@ export interface ModelRerankParams {
9868
}
9969

10070
export declare namespace Models {
101-
export {
102-
type ModelParseDocumentResponse as ModelParseDocumentResponse,
103-
type ModelRerankResponse as ModelRerankResponse,
104-
type ModelParseDocumentParams as ModelParseDocumentParams,
105-
type ModelRerankParams as ModelRerankParams,
106-
};
71+
export { type ModelRerankResponse as ModelRerankResponse, type ModelRerankParams as ModelRerankParams };
10772
}

src/resources/parsers.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 Parsers extends APIResource {
7+
/**
8+
* This provides access to the parsers that we use for indexing. This endpoint will
9+
* not access any collection or search index, and the result will not be saved.
10+
* This will use the same parsing method as the `/documents/add-document` endpoint.
11+
*
12+
* A common use-case for this endpoint, is to use our parser in combination with
13+
* your own pre-processing step, before then uploading it to the search index using
14+
* the `text-pages` filetype.
15+
*/
16+
parseDocument(
17+
body: ParserParseDocumentParams,
18+
options?: Core.RequestOptions,
19+
): Core.APIPromise<ParserParseDocumentResponse> {
20+
return this._client.post('/parsers/parse-document', { body, ...options });
21+
}
22+
}
23+
24+
export interface ParserParseDocumentResponse {
25+
/**
26+
* The parsed pages. Each string will contain the full contents of a page.
27+
*/
28+
pages: Array<string>;
29+
}
30+
31+
export interface ParserParseDocumentParams {
32+
/**
33+
* The document's raw data, as a base64-encoded string
34+
*/
35+
base64_data: string;
36+
}
37+
38+
export declare namespace Parsers {
39+
export {
40+
type ParserParseDocumentResponse as ParserParseDocumentResponse,
41+
type ParserParseDocumentParams as ParserParseDocumentParams,
42+
};
43+
}

tests/api-resources/models.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ const client = new ZeroEntropy({
99
});
1010

1111
describe('resource models', () => {
12-
test('parseDocument: only required params', async () => {
13-
const responsePromise = client.models.parseDocument({ base64_data: 'base64_data' });
14-
const rawResponse = await responsePromise.asResponse();
15-
expect(rawResponse).toBeInstanceOf(Response);
16-
const response = await responsePromise;
17-
expect(response).not.toBeInstanceOf(Response);
18-
const dataAndResponse = await responsePromise.withResponse();
19-
expect(dataAndResponse.data).toBe(response);
20-
expect(dataAndResponse.response).toBe(rawResponse);
21-
});
22-
23-
test('parseDocument: required and optional params', async () => {
24-
const response = await client.models.parseDocument({ base64_data: 'base64_data' });
25-
});
26-
2712
test('rerank: only required params', async () => {
2813
const responsePromise = client.models.rerank({ documents: ['string'], query: 'query' });
2914
const rawResponse = await responsePromise.asResponse();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import ZeroEntropy from 'zeroentropy';
4+
import { Response } from 'node-fetch';
5+
6+
const client = new ZeroEntropy({
7+
apiKey: 'My API Key',
8+
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
9+
});
10+
11+
describe('resource parsers', () => {
12+
test('parseDocument: only required params', async () => {
13+
const responsePromise = client.parsers.parseDocument({ base64_data: 'base64_data' });
14+
const rawResponse = await responsePromise.asResponse();
15+
expect(rawResponse).toBeInstanceOf(Response);
16+
const response = await responsePromise;
17+
expect(response).not.toBeInstanceOf(Response);
18+
const dataAndResponse = await responsePromise.withResponse();
19+
expect(dataAndResponse.data).toBe(response);
20+
expect(dataAndResponse.response).toBe(rawResponse);
21+
});
22+
23+
test('parseDocument: required and optional params', async () => {
24+
const response = await client.parsers.parseDocument({ base64_data: 'base64_data' });
25+
});
26+
});

0 commit comments

Comments
 (0)