sarvamai 1.1.16-alpha.2 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/chat/client/Client.js +8 -0
- package/dist/cjs/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.ts +4 -4
- package/dist/cjs/api/resources/decisions/client/Client.d.ts +12 -4
- package/dist/cjs/api/resources/decisions/client/Client.js +12 -4
- package/dist/cjs/api/resources/decisions/client/requests/SystemOneRequest.d.ts +1 -1
- package/dist/cjs/api/resources/docAi/client/Client.d.ts +6 -13
- package/dist/cjs/api/resources/docAi/client/Client.js +6 -22
- package/dist/cjs/api/resources/docAi/client/requests/DocAiExtractRequest.d.ts +3 -14
- package/dist/cjs/api/resources/docAi/client/requests/DocAiExtractRequest.js +0 -5
- package/dist/cjs/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.ts +3 -2
- package/dist/cjs/api/resources/docAi/client/requests/DocAiParseRequest.d.ts +4 -15
- package/dist/cjs/api/resources/docAi/client/requests/DocAiParseRequest.js +1 -7
- package/dist/cjs/api/resources/docAi/types/DocAiGetResultsResponse.d.ts +1 -4
- package/dist/cjs/api/resources/docAi/types/Format.d.ts +6 -0
- package/dist/cjs/api/resources/docAi/types/Format.js +9 -0
- package/dist/cjs/api/resources/docAi/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/docAi/types/index.js +1 -0
- package/dist/cjs/api/resources/responses/client/Client.js +4 -0
- package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateRequest.d.ts +5 -1
- package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.ts +5 -1
- package/dist/cjs/api/types/Choice.d.ts +1 -1
- package/dist/cjs/api/types/CreateResponseV2Request.d.ts +5 -1
- package/dist/cjs/api/types/DocAiJobStatusResponse.d.ts +1 -1
- package/dist/cjs/api/types/DocAiParseResults.d.ts +6 -39
- package/dist/cjs/api/types/DocAiPresignUploadResponse.d.ts +1 -1
- package/dist/cjs/api/types/ModelObject.d.ts +10 -0
- package/dist/cjs/api/types/ModelObject.js +9 -0
- package/dist/cjs/api/types/ReasoningEffort.d.ts +2 -1
- package/dist/cjs/api/types/ReasoningEffort.js +2 -1
- package/dist/cjs/api/types/ResponseReasoning.d.ts +1 -1
- package/dist/cjs/api/types/ResponseReasoningEffort.d.ts +2 -1
- package/dist/cjs/api/types/ResponseReasoningEffort.js +2 -1
- package/dist/cjs/api/types/ResponsesModelIds.d.ts +7 -1
- package/dist/cjs/api/types/ResponsesModelIds.js +7 -1
- package/dist/cjs/api/types/V2ModelIds.d.ts +8 -2
- package/dist/cjs/api/types/V2ModelIds.js +8 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/chat/client/Client.mjs +8 -0
- package/dist/esm/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.mts +4 -4
- package/dist/esm/api/resources/decisions/client/Client.d.mts +12 -4
- package/dist/esm/api/resources/decisions/client/Client.mjs +12 -4
- package/dist/esm/api/resources/decisions/client/requests/SystemOneRequest.d.mts +1 -1
- package/dist/esm/api/resources/docAi/client/Client.d.mts +6 -13
- package/dist/esm/api/resources/docAi/client/Client.mjs +6 -22
- package/dist/esm/api/resources/docAi/client/requests/DocAiExtractRequest.d.mts +3 -14
- package/dist/esm/api/resources/docAi/client/requests/DocAiExtractRequest.mjs +0 -5
- package/dist/esm/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.mts +3 -2
- package/dist/esm/api/resources/docAi/client/requests/DocAiParseRequest.d.mts +4 -15
- package/dist/esm/api/resources/docAi/client/requests/DocAiParseRequest.mjs +1 -7
- package/dist/esm/api/resources/docAi/types/DocAiGetResultsResponse.d.mts +1 -4
- package/dist/esm/api/resources/docAi/types/Format.d.mts +6 -0
- package/dist/esm/api/resources/docAi/types/Format.mjs +6 -0
- package/dist/esm/api/resources/docAi/types/index.d.mts +1 -0
- package/dist/esm/api/resources/docAi/types/index.mjs +1 -0
- package/dist/esm/api/resources/responses/client/Client.mjs +4 -0
- package/dist/esm/api/resources/responses/client/requests/ResponsesCreateRequest.d.mts +5 -1
- package/dist/esm/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.mts +5 -1
- package/dist/esm/api/types/Choice.d.mts +1 -1
- package/dist/esm/api/types/CreateResponseV2Request.d.mts +5 -1
- package/dist/esm/api/types/DocAiJobStatusResponse.d.mts +1 -1
- package/dist/esm/api/types/DocAiParseResults.d.mts +6 -39
- package/dist/esm/api/types/DocAiPresignUploadResponse.d.mts +1 -1
- package/dist/esm/api/types/ModelObject.d.mts +10 -0
- package/dist/esm/api/types/ModelObject.mjs +8 -1
- package/dist/esm/api/types/ReasoningEffort.d.mts +2 -1
- package/dist/esm/api/types/ReasoningEffort.mjs +2 -1
- package/dist/esm/api/types/ResponseReasoning.d.mts +1 -1
- package/dist/esm/api/types/ResponseReasoningEffort.d.mts +2 -1
- package/dist/esm/api/types/ResponseReasoningEffort.mjs +2 -1
- package/dist/esm/api/types/ResponsesModelIds.d.mts +7 -1
- package/dist/esm/api/types/ResponsesModelIds.mjs +7 -1
- package/dist/esm/api/types/V2ModelIds.d.mts +8 -2
- package/dist/esm/api/types/V2ModelIds.mjs +8 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +19 -18
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "sarvamai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.1.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.17",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.17",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -341,8 +341,12 @@ class ChatClient {
|
|
|
341
341
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
342
342
|
case 401:
|
|
343
343
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
344
|
+
case 402:
|
|
345
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
344
346
|
case 403:
|
|
345
347
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
348
|
+
case 404:
|
|
349
|
+
throw new SarvamAI.NotFoundError(body, rawResponse);
|
|
346
350
|
case 413:
|
|
347
351
|
throw new SarvamAI.ContentTooLargeError(body, rawResponse);
|
|
348
352
|
case 422:
|
|
@@ -351,8 +355,12 @@ class ChatClient {
|
|
|
351
355
|
throw new SarvamAI.TooManyRequestsError(body, rawResponse);
|
|
352
356
|
case 500:
|
|
353
357
|
throw new SarvamAI.InternalServerError(body, rawResponse);
|
|
358
|
+
case 502:
|
|
359
|
+
throw new SarvamAI.BadGatewayError(body, rawResponse);
|
|
354
360
|
case 503:
|
|
355
361
|
throw new SarvamAI.ServiceUnavailableError(body, rawResponse);
|
|
362
|
+
case 504:
|
|
363
|
+
throw new SarvamAI.GatewayTimeoutError(body, rawResponse);
|
|
356
364
|
default:
|
|
357
365
|
throw new errors.SarvamAIError({
|
|
358
366
|
statusCode,
|
|
@@ -20,14 +20,14 @@ export interface CreateChatCompletionV2Request {
|
|
|
20
20
|
temperature?: number;
|
|
21
21
|
/** Nucleus sampling: greater than `0` and at most `1`. On `glm5.3`, `top_p: 0` is rejected. Prefer changing either `top_p` or `temperature`, not both. */
|
|
22
22
|
top_p?: number;
|
|
23
|
-
/** On reasoning models
|
|
23
|
+
/** On reasoning models: **`low`**, **`high`**, or **`max`** on every reasoning model, and **`medium`** on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b` (`kimi-k3.1-pro` runs `medium` as `high`). Default when omitted is **`max`** on `glm5.3` and `kimi-k3.1-pro`, **`high`** on `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, and no reasoning on `gemma4`; `qwen38-27b` thinks by default. **`none`** turns thinking off on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`. `kimi-k3.1-pro` always thinks: `none`, `minimal`, and `xhigh` return `400`. Trace in `message.reasoning_content`; billed as completion tokens and counts toward `max_tokens`. On `gemma4`, reasoning is off unless this is set (`low`, `high`, or `max`). */
|
|
24
24
|
reasoning_effort?: SarvamAI.ReasoningEffort;
|
|
25
25
|
/** Maximum tokens to generate in the completion, including reasoning tokens on reasoning models. Default `2048`. Set explicitly when you need longer answers — a low limit can yield `finish_reason: "length"` with little or no visible `content` if reasoning consumes the budget. */
|
|
26
26
|
max_tokens?: number;
|
|
27
27
|
/** Optional. Default `false` — omit or `false` for one JSON response. If `true`, the response is streamed as server-sent events and ends with a `[DONE]` line. Use `stream_options.include_usage: true` to receive a final usage chunk (including `reasoning_tokens`). That chunk has an empty `choices` array — do not assume `choices[0]` is present on every event. */
|
|
28
28
|
stream?: boolean;
|
|
29
29
|
stop?: SarvamAI.StopConfiguration;
|
|
30
|
-
/** Number of chat completion choices
|
|
30
|
+
/** Number of chat completion choices. Only `1` is supported (the default); values above `1` return `400 invalid_request_error`. Send separate requests for more completions. */
|
|
31
31
|
n?: number;
|
|
32
32
|
/** Optional integer seed for OpenAI SDK compatibility. */
|
|
33
33
|
seed?: number;
|
|
@@ -59,8 +59,8 @@ export interface CreateChatCompletionV2Request {
|
|
|
59
59
|
parallel_tool_calls?: boolean;
|
|
60
60
|
/** Only valid with `stream: true` (otherwise `400`). Must be a top-level field, not inside `extra_body`. Use `{"include_usage": true}` to receive token usage in the final SSE chunk. */
|
|
61
61
|
stream_options?: SarvamAI.ChatStreamOptions;
|
|
62
|
-
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4-pro`**, and **`
|
|
62
|
+
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4.1-flash-1017-interactive`**, **`deepseekv4-pro`**, and **`qwen38-27b`**. Not supported on **`glm5.3`** or **`kimi-k3.1-pro`** (`400` if enabled). */
|
|
63
63
|
logprobs?: boolean;
|
|
64
|
-
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `
|
|
64
|
+
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; on `glm5.3` and `kimi-k3.1-pro`, omit entirely — do not send `0`, since many SDKs add it by default. */
|
|
65
65
|
top_logprobs?: number;
|
|
66
66
|
}
|
|
@@ -11,17 +11,25 @@ export declare class DecisionsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<DecisionsClient.Options>;
|
|
12
12
|
constructor(options?: DecisionsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
14
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
15
|
+
*
|
|
16
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
15
17
|
*
|
|
16
18
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
17
19
|
*
|
|
18
20
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
19
21
|
*
|
|
20
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
22
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
23
|
+
*
|
|
24
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
25
|
+
*
|
|
26
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
21
27
|
*
|
|
22
|
-
* **
|
|
28
|
+
* **Limits:**
|
|
29
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
30
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
23
31
|
*
|
|
24
|
-
*
|
|
32
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
25
33
|
*
|
|
26
34
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
27
35
|
*
|
|
@@ -56,17 +56,25 @@ class DecisionsClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
59
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
60
|
+
*
|
|
61
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
60
62
|
*
|
|
61
63
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
62
64
|
*
|
|
63
65
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
64
66
|
*
|
|
65
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
67
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
68
|
+
*
|
|
69
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
70
|
+
*
|
|
71
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
66
72
|
*
|
|
67
|
-
* **
|
|
73
|
+
* **Limits:**
|
|
74
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
75
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
68
76
|
*
|
|
69
|
-
*
|
|
77
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
70
78
|
*
|
|
71
79
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
72
80
|
*
|
|
@@ -20,7 +20,7 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
20
20
|
* }
|
|
21
21
|
*/
|
|
22
22
|
export interface SystemOneRequest {
|
|
23
|
-
/** The decision model to use.
|
|
23
|
+
/** The decision model to use. `sarvam-prism` (Sarvam Prism, serverless) or `clef` (Clef, on Provisioned Throughput; also accepts base64 `images`, up to 65,536 tokens per request). */
|
|
24
24
|
model: string;
|
|
25
25
|
/** The input to decide on: text, or an object or array that is rendered as compact JSON. Required; an empty string is allowed. It is never truncated: if any one question (state + question + options) exceeds 32,768 tokens the request fails with `422`. */
|
|
26
26
|
state: SystemOneRequest.State;
|
|
@@ -16,7 +16,7 @@ export declare class DocAiClient {
|
|
|
16
16
|
* **Flow:**
|
|
17
17
|
* 1. Call this endpoint with the MIME type you will upload (e.g. `application/pdf`).
|
|
18
18
|
* 2. Upload the file using the returned `method`, `url` and `headers` before `expires_at`.
|
|
19
|
-
* 3. Pass the returned `upload_id` through the `upload_ids` field on a later parse
|
|
19
|
+
* 3. Pass the returned `upload_id` through the `upload_ids` field on a later parse or extract job request.
|
|
20
20
|
*
|
|
21
21
|
* When `content_type` is set, the upload's `Content-Type` header must match it.
|
|
22
22
|
*
|
|
@@ -55,9 +55,7 @@ export declare class DocAiClient {
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* import { createReadStream } from "fs";
|
|
58
|
-
* await client.docAi.parse({
|
|
59
|
-
* language: "en-IN"
|
|
60
|
-
* })
|
|
58
|
+
* await client.docAi.parse({})
|
|
61
59
|
*/
|
|
62
60
|
parse(request: SarvamAI.DocAiParseRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiStartJobResponse>;
|
|
63
61
|
private __parse;
|
|
@@ -86,19 +84,16 @@ export declare class DocAiClient {
|
|
|
86
84
|
* import { createReadStream } from "fs";
|
|
87
85
|
* await client.docAi.extract({
|
|
88
86
|
* schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
|
|
89
|
-
* output_format: "json"
|
|
90
|
-
* mode: "basic"
|
|
87
|
+
* output_format: "json"
|
|
91
88
|
* })
|
|
92
89
|
*/
|
|
93
90
|
extract(request: SarvamAI.DocAiExtractRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiStartJobResponse>;
|
|
94
91
|
private __extract;
|
|
95
92
|
/**
|
|
96
|
-
* Creates a Classify job. Classify labels a document against the categories you define, or suggests a document type when you supply none.
|
|
93
|
+
* Creates a Classify job. Classify labels a document, or each page, against the categories you define, or suggests a document type when you supply none.
|
|
97
94
|
*
|
|
98
95
|
* **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request` with the options below. You can also send a JSON body with `input` set to `{"document_ref": "..."}` to classify a child document returned by Split.
|
|
99
96
|
*
|
|
100
|
-
* **Availability:** options are enabled per deployment. If your deployment does not support an option, the request fails with `400 INVALID_REQUEST` (for example `additional properties 'scope' not allowed`). Call `GET /doc-ai/v1/capabilities` to see what is enabled, and send only those options.
|
|
101
|
-
*
|
|
102
97
|
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. Add `?include=details` to the results for inspected pages, provenance and evidence.
|
|
103
98
|
*
|
|
104
99
|
* **Review:** `review_required` tells you whether a person should check the answer. `confidence` can be `null`; it is a token-based score, not a measured probability.
|
|
@@ -127,9 +122,7 @@ export declare class DocAiClient {
|
|
|
127
122
|
*
|
|
128
123
|
* **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request`.
|
|
129
124
|
*
|
|
130
|
-
* **
|
|
131
|
-
*
|
|
132
|
-
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check `review_required` on each segment.
|
|
125
|
+
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check each segment's `review.required`.
|
|
133
126
|
*
|
|
134
127
|
* @param {SarvamAI.DocAiSplitRequest} request
|
|
135
128
|
* @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -183,7 +176,7 @@ export declare class DocAiClient {
|
|
|
183
176
|
* })
|
|
184
177
|
*
|
|
185
178
|
* @example
|
|
186
|
-
* await client.docAi.getResults("
|
|
179
|
+
* await client.docAi.getResults("20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", {
|
|
187
180
|
* format: "json"
|
|
188
181
|
* })
|
|
189
182
|
*
|
|
@@ -62,7 +62,7 @@ class DocAiClient {
|
|
|
62
62
|
* **Flow:**
|
|
63
63
|
* 1. Call this endpoint with the MIME type you will upload (e.g. `application/pdf`).
|
|
64
64
|
* 2. Upload the file using the returned `method`, `url` and `headers` before `expires_at`.
|
|
65
|
-
* 3. Pass the returned `upload_id` through the `upload_ids` field on a later parse
|
|
65
|
+
* 3. Pass the returned `upload_id` through the `upload_ids` field on a later parse or extract job request.
|
|
66
66
|
*
|
|
67
67
|
* When `content_type` is set, the upload's `Content-Type` header must match it.
|
|
68
68
|
*
|
|
@@ -147,9 +147,7 @@ class DocAiClient {
|
|
|
147
147
|
*
|
|
148
148
|
* @example
|
|
149
149
|
* import { createReadStream } from "fs";
|
|
150
|
-
* await client.docAi.parse({
|
|
151
|
-
* language: "en-IN"
|
|
152
|
-
* })
|
|
150
|
+
* await client.docAi.parse({})
|
|
153
151
|
*/
|
|
154
152
|
parse(request, requestOptions) {
|
|
155
153
|
return core.HttpResponsePromise.fromPromise(this.__parse(request, requestOptions));
|
|
@@ -169,9 +167,6 @@ class DocAiClient {
|
|
|
169
167
|
if (request.language != null) {
|
|
170
168
|
_body.append("language", request.language);
|
|
171
169
|
}
|
|
172
|
-
if (request.output_format != null) {
|
|
173
|
-
_body.append("output_format", request.output_format);
|
|
174
|
-
}
|
|
175
170
|
if (request.content_type != null) {
|
|
176
171
|
_body.append("content_type", request.content_type);
|
|
177
172
|
}
|
|
@@ -248,8 +243,7 @@ class DocAiClient {
|
|
|
248
243
|
* import { createReadStream } from "fs";
|
|
249
244
|
* await client.docAi.extract({
|
|
250
245
|
* schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
|
|
251
|
-
* output_format: "json"
|
|
252
|
-
* mode: "basic"
|
|
246
|
+
* output_format: "json"
|
|
253
247
|
* })
|
|
254
248
|
*/
|
|
255
249
|
extract(request, requestOptions) {
|
|
@@ -273,15 +267,9 @@ class DocAiClient {
|
|
|
273
267
|
if (request.config_id != null) {
|
|
274
268
|
_body.append("config_id", request.config_id);
|
|
275
269
|
}
|
|
276
|
-
if (request.language != null) {
|
|
277
|
-
_body.append("language", request.language);
|
|
278
|
-
}
|
|
279
270
|
if (request.output_format != null) {
|
|
280
271
|
_body.append("output_format", request.output_format);
|
|
281
272
|
}
|
|
282
|
-
if (request.mode != null) {
|
|
283
|
-
_body.append("mode", request.mode);
|
|
284
|
-
}
|
|
285
273
|
if (request.classification != null) {
|
|
286
274
|
_body.append("classification", request.classification);
|
|
287
275
|
}
|
|
@@ -334,12 +322,10 @@ class DocAiClient {
|
|
|
334
322
|
});
|
|
335
323
|
}
|
|
336
324
|
/**
|
|
337
|
-
* Creates a Classify job. Classify labels a document against the categories you define, or suggests a document type when you supply none.
|
|
325
|
+
* Creates a Classify job. Classify labels a document, or each page, against the categories you define, or suggests a document type when you supply none.
|
|
338
326
|
*
|
|
339
327
|
* **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request` with the options below. You can also send a JSON body with `input` set to `{"document_ref": "..."}` to classify a child document returned by Split.
|
|
340
328
|
*
|
|
341
|
-
* **Availability:** options are enabled per deployment. If your deployment does not support an option, the request fails with `400 INVALID_REQUEST` (for example `additional properties 'scope' not allowed`). Call `GET /doc-ai/v1/capabilities` to see what is enabled, and send only those options.
|
|
342
|
-
*
|
|
343
329
|
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. Add `?include=details` to the results for inspected pages, provenance and evidence.
|
|
344
330
|
*
|
|
345
331
|
* **Review:** `review_required` tells you whether a person should check the answer. `confidence` can be `null`; it is a token-based score, not a measured probability.
|
|
@@ -425,9 +411,7 @@ class DocAiClient {
|
|
|
425
411
|
*
|
|
426
412
|
* **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request`.
|
|
427
413
|
*
|
|
428
|
-
* **
|
|
429
|
-
*
|
|
430
|
-
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check `review_required` on each segment.
|
|
414
|
+
* **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check each segment's `review.required`.
|
|
431
415
|
*
|
|
432
416
|
* @param {SarvamAI.DocAiSplitRequest} request
|
|
433
417
|
* @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -573,7 +557,7 @@ class DocAiClient {
|
|
|
573
557
|
* })
|
|
574
558
|
*
|
|
575
559
|
* @example
|
|
576
|
-
* await client.docAi.getResults("
|
|
560
|
+
* await client.docAi.getResults("20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", {
|
|
577
561
|
* format: "json"
|
|
578
562
|
* })
|
|
579
563
|
*
|
|
@@ -3,8 +3,7 @@ import type * as core from "../../../../../core/index.js";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
|
|
6
|
-
* output_format: "json"
|
|
7
|
-
* mode: "basic"
|
|
6
|
+
* output_format: "json"
|
|
8
7
|
* }
|
|
9
8
|
*/
|
|
10
9
|
export interface DocAiExtractRequest {
|
|
@@ -14,17 +13,13 @@ export interface DocAiExtractRequest {
|
|
|
14
13
|
upload_ids?: string;
|
|
15
14
|
/** Inline extraction schema as a JSON string. The root must be `type: "object"` with non-empty `properties`; every field needs a `type` and a non-empty `description`. Supported types: `string`, `number`, `integer`, `boolean`, `object`, `array` (objects need `properties`, arrays need `items`); optional `enum`; maximum nesting depth 4. Exactly one of `schema` and `config_id` is required. */
|
|
16
15
|
schema?: string;
|
|
17
|
-
/** Saved extraction configuration ID. Exactly one of `schema` and `config_id` is required. To get your config_id, see [Reuse a schema](/api/api-guides-tutorials/document-intelligence/extract#reuse-a-schema). */
|
|
16
|
+
/** Saved extraction configuration ID. Exactly one of `schema` and `config_id` is required. To get your config_id, see [Reuse a schema](/api/api-guides-tutorials/document-intelligence/how-to/extract#reuse-a-schema). */
|
|
18
17
|
config_id?: string;
|
|
19
|
-
/** Language code of the document (BCP-47), e.g. `en-IN`, `hi-IN`. Always pass the correct code for best accuracy. */
|
|
20
|
-
language?: string;
|
|
21
18
|
/** Output format of the extraction results. */
|
|
22
19
|
output_format?: DocAiExtractRequest.OutputFormat;
|
|
23
|
-
/** Extraction mode. `basic` (default) runs the standard extraction pipeline; `advanced` runs the enhanced pipeline for complex documents. */
|
|
24
|
-
mode?: DocAiExtractRequest.Mode;
|
|
25
20
|
/** Enable document classification. Boolean sent as text: `true` or `false`. */
|
|
26
21
|
classification?: string;
|
|
27
|
-
/** Model to use for extraction.
|
|
22
|
+
/** Model to use for extraction. */
|
|
28
23
|
model?: string;
|
|
29
24
|
}
|
|
30
25
|
export declare namespace DocAiExtractRequest {
|
|
@@ -35,10 +30,4 @@ export declare namespace DocAiExtractRequest {
|
|
|
35
30
|
readonly Xlsx: "xlsx";
|
|
36
31
|
};
|
|
37
32
|
type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
|
|
38
|
-
/** Extraction mode. `basic` (default) runs the standard extraction pipeline; `advanced` runs the enhanced pipeline for complex documents. */
|
|
39
|
-
const Mode: {
|
|
40
|
-
readonly Basic: "basic";
|
|
41
|
-
readonly Advanced: "advanced";
|
|
42
|
-
};
|
|
43
|
-
type Mode = (typeof Mode)[keyof typeof Mode];
|
|
44
33
|
}
|
|
@@ -10,9 +10,4 @@ var DocAiExtractRequest;
|
|
|
10
10
|
Csv: "csv",
|
|
11
11
|
Xlsx: "xlsx",
|
|
12
12
|
};
|
|
13
|
-
/** Extraction mode. `basic` (default) runs the standard extraction pipeline; `advanced` runs the enhanced pipeline for complex documents. */
|
|
14
|
-
DocAiExtractRequest.Mode = {
|
|
15
|
-
Basic: "basic",
|
|
16
|
-
Advanced: "advanced",
|
|
17
|
-
};
|
|
18
13
|
})(DocAiExtractRequest || (exports.DocAiExtractRequest = DocAiExtractRequest = {}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as SarvamAI from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
@@ -16,8 +17,8 @@
|
|
|
16
17
|
* {}
|
|
17
18
|
*/
|
|
18
19
|
export interface DocAiGetResultsRequest {
|
|
19
|
-
/** Output format of the results. `
|
|
20
|
-
format?:
|
|
20
|
+
/** Output format of the results. Choose `md` for Markdown, `html` for HTML, or `json` for structured JSON. If you omit `format`, the results are returned as `json` by default. */
|
|
21
|
+
format?: SarvamAI.Format;
|
|
21
22
|
/** Set to `details` for Classify and Split jobs to add inspected pages, provenance and boundary details. Supporting evidence also needs `output.include_evidence` on the request. */
|
|
22
23
|
include?: "details";
|
|
23
24
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
|
-
* {
|
|
5
|
-
* language: "en-IN"
|
|
6
|
-
* }
|
|
4
|
+
* {}
|
|
7
5
|
*/
|
|
8
6
|
export interface DocAiParseRequest {
|
|
9
7
|
/** Document file(s) to parse. Repeatable multipart part. Exactly one of `file` and `upload_ids` must be provided. */
|
|
@@ -12,22 +10,13 @@ export interface DocAiParseRequest {
|
|
|
12
10
|
upload_ids?: string;
|
|
13
11
|
/** Language of the document in BCP-47 format (e.g. `hi-IN`, `en-IN`). Defaults to Indic: when omitted, the document is processed as an Indic-language document. To process an English document, set `language` to `en-IN`. Sarvam Vision supports 22 Indian languages plus English; see the [Sarvam Vision model page](/api/api-guides-tutorials/models/sarvam-vision) for the full list. */
|
|
14
12
|
language?: string;
|
|
15
|
-
/**
|
|
16
|
-
output_format?: DocAiParseRequest.OutputFormat;
|
|
17
|
-
/** Nature of the document content: `printed` (typed or printed text), `handwritten`, or `mixed`. */
|
|
13
|
+
/** Nature of the document content. */
|
|
18
14
|
content_type?: DocAiParseRequest.ContentType;
|
|
19
|
-
/** Model to use for
|
|
15
|
+
/** Model to use for digitisation. */
|
|
20
16
|
model?: string;
|
|
21
17
|
}
|
|
22
18
|
export declare namespace DocAiParseRequest {
|
|
23
|
-
/**
|
|
24
|
-
const OutputFormat: {
|
|
25
|
-
readonly Html: "html";
|
|
26
|
-
readonly Md: "md";
|
|
27
|
-
readonly Json: "json";
|
|
28
|
-
};
|
|
29
|
-
type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
|
|
30
|
-
/** Nature of the document content: `printed` (typed or printed text), `handwritten`, or `mixed`. */
|
|
19
|
+
/** Nature of the document content. */
|
|
31
20
|
const ContentType: {
|
|
32
21
|
readonly Printed: "printed";
|
|
33
22
|
readonly Handwritten: "handwritten";
|
|
@@ -4,13 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.DocAiParseRequest = void 0;
|
|
5
5
|
var DocAiParseRequest;
|
|
6
6
|
(function (DocAiParseRequest) {
|
|
7
|
-
/**
|
|
8
|
-
DocAiParseRequest.OutputFormat = {
|
|
9
|
-
Html: "html",
|
|
10
|
-
Md: "md",
|
|
11
|
-
Json: "json",
|
|
12
|
-
};
|
|
13
|
-
/** Nature of the document content: `printed` (typed or printed text), `handwritten`, or `mixed`. */
|
|
7
|
+
/** Nature of the document content. */
|
|
14
8
|
DocAiParseRequest.ContentType = {
|
|
15
9
|
Printed: "printed",
|
|
16
10
|
Handwritten: "handwritten",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as SarvamAI from "../../../index.js";
|
|
2
|
-
export type DocAiGetResultsResponse = SarvamAI.DocAiGetResultsResponse.Extract | SarvamAI.DocAiGetResultsResponse.Parse | SarvamAI.DocAiGetResultsResponse.
|
|
2
|
+
export type DocAiGetResultsResponse = SarvamAI.DocAiGetResultsResponse.Extract | SarvamAI.DocAiGetResultsResponse.Parse | SarvamAI.DocAiGetResultsResponse.Classify | SarvamAI.DocAiGetResultsResponse.Split;
|
|
3
3
|
export declare namespace DocAiGetResultsResponse {
|
|
4
4
|
interface Extract extends SarvamAI.DocAiExtractResults {
|
|
5
5
|
type: "extract";
|
|
@@ -7,9 +7,6 @@ export declare namespace DocAiGetResultsResponse {
|
|
|
7
7
|
interface Parse extends SarvamAI.DocAiParseResults {
|
|
8
8
|
type: "parse";
|
|
9
9
|
}
|
|
10
|
-
interface Digitise extends SarvamAI.DocAiParseResults {
|
|
11
|
-
type: "digitise";
|
|
12
|
-
}
|
|
13
10
|
interface Classify extends SarvamAI.DocAiClassifyResults {
|
|
14
11
|
type: "classify";
|
|
15
12
|
}
|
|
@@ -175,6 +175,8 @@ class ResponsesClient {
|
|
|
175
175
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
176
176
|
case 401:
|
|
177
177
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
178
|
+
case 402:
|
|
179
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
178
180
|
case 403:
|
|
179
181
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
180
182
|
case 404:
|
|
@@ -221,6 +223,8 @@ class ResponsesClient {
|
|
|
221
223
|
throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
222
224
|
case 401:
|
|
223
225
|
throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
226
|
+
case 402:
|
|
227
|
+
throw new SarvamAI.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
224
228
|
case 403:
|
|
225
229
|
throw new SarvamAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
226
230
|
case 404:
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateStreamRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateStreamRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateStreamRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -9,7 +9,7 @@ export interface Choice {
|
|
|
9
9
|
finish_reason: SarvamAI.FinishReason;
|
|
10
10
|
/** The index of the choice in the list of choices. */
|
|
11
11
|
index: number;
|
|
12
|
-
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-
|
|
12
|
+
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `qwen38-27b`). Not supported on `glm5.3` or `kimi-k3.1-pro`, which return `400` when `logprobs` is set. */
|
|
13
13
|
logprobs?: Record<string, unknown> | undefined;
|
|
14
14
|
message: SarvamAI.ChatCompletionResponseMessage;
|
|
15
15
|
}
|
|
@@ -14,7 +14,7 @@ export interface CreateResponseV2Request {
|
|
|
14
14
|
tools?: SarvamAI.ResponseFunctionTool[] | undefined;
|
|
15
15
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
16
16
|
tool_choice?: CreateResponseV2Request.ToolChoice | undefined;
|
|
17
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
17
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
18
18
|
reasoning?: SarvamAI.ResponseReasoning | undefined;
|
|
19
19
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
20
20
|
extra_body?: Record<string, unknown> | undefined;
|
|
@@ -43,6 +43,10 @@ export interface CreateResponseV2Request {
|
|
|
43
43
|
background?: boolean | undefined;
|
|
44
44
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
45
45
|
max_tool_calls?: number | undefined;
|
|
46
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
47
|
+
top_logprobs?: number | undefined;
|
|
48
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
49
|
+
include?: string[] | undefined;
|
|
46
50
|
/** Accepts any additional properties */
|
|
47
51
|
[key: string]: any;
|
|
48
52
|
}
|
|
@@ -4,7 +4,7 @@ export interface DocAiJobStatusResponse {
|
|
|
4
4
|
job_id: string;
|
|
5
5
|
/** Current status of the job. Terminal statuses: `completed`, `partially_completed`, `failed`, `rejected`. */
|
|
6
6
|
status: string;
|
|
7
|
-
/** Job pipeline: `
|
|
7
|
+
/** Job pipeline: `parse` or `extract`. Classify and Split jobs report `type` instead. */
|
|
8
8
|
pipeline?: string | undefined;
|
|
9
9
|
usage: SarvamAI.DocAiUsage;
|
|
10
10
|
/** Job creation timestamp. */
|