sarvamai 1.1.4 → 1.1.5-alpha.1
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.d.ts +3 -5
- package/dist/cjs/api/resources/chat/client/Client.js +4 -6
- package/dist/cjs/api/resources/chat/client/requests/ChatCompletionsRequest.d.ts +12 -4
- package/dist/cjs/api/types/ChatCompletionMessageToolCall.d.ts +8 -0
- package/dist/cjs/api/types/ChatCompletionMessageToolCall.js +3 -0
- package/dist/cjs/api/types/ChatCompletionNamedToolChoice.d.ts +6 -0
- package/dist/cjs/api/types/ChatCompletionNamedToolChoice.js +3 -0
- package/dist/cjs/api/types/ChatCompletionNamedToolChoiceFunction.d.ts +4 -0
- package/dist/cjs/api/types/ChatCompletionNamedToolChoiceFunction.js +3 -0
- package/dist/cjs/api/types/ChatCompletionRequestAssistantMessage.d.ts +4 -1
- package/dist/cjs/api/types/ChatCompletionRequestMessage.d.ts +4 -1
- package/dist/cjs/api/types/ChatCompletionRequestToolMessage.d.ts +6 -0
- package/dist/cjs/api/types/ChatCompletionRequestToolMessage.js +3 -0
- package/dist/cjs/api/types/ChatCompletionResponseMessage.d.ts +6 -1
- package/dist/cjs/api/types/ChatCompletionTool.d.ts +6 -0
- package/dist/cjs/api/types/ChatCompletionTool.js +3 -0
- package/dist/cjs/api/types/Choice.d.ts +1 -0
- package/dist/cjs/api/types/CompletionUsage.d.ts +2 -0
- package/dist/cjs/api/types/CreateChatCompletionResponse.d.ts +2 -0
- package/dist/cjs/api/types/FunctionCall.d.ts +6 -0
- package/dist/cjs/api/types/FunctionCall.js +3 -0
- package/dist/cjs/api/types/FunctionDefinition.d.ts +8 -0
- package/dist/cjs/api/types/FunctionDefinition.js +3 -0
- package/dist/cjs/api/types/SarvamModelIds.d.ts +8 -1
- package/dist/cjs/api/types/SarvamModelIds.js +8 -0
- package/dist/cjs/api/types/ToolChoiceOption.d.ts +2 -0
- package/dist/cjs/api/types/ToolChoiceOption.js +3 -0
- package/dist/cjs/api/types/index.d.ts +8 -0
- package/dist/cjs/api/types/index.js +8 -0
- 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.d.mts +3 -5
- package/dist/esm/api/resources/chat/client/Client.mjs +4 -6
- package/dist/esm/api/resources/chat/client/requests/ChatCompletionsRequest.d.mts +12 -4
- package/dist/esm/api/types/ChatCompletionMessageToolCall.d.mts +8 -0
- package/dist/esm/api/types/ChatCompletionMessageToolCall.mjs +2 -0
- package/dist/esm/api/types/ChatCompletionNamedToolChoice.d.mts +6 -0
- package/dist/esm/api/types/ChatCompletionNamedToolChoice.mjs +2 -0
- package/dist/esm/api/types/ChatCompletionNamedToolChoiceFunction.d.mts +4 -0
- package/dist/esm/api/types/ChatCompletionNamedToolChoiceFunction.mjs +2 -0
- package/dist/esm/api/types/ChatCompletionRequestAssistantMessage.d.mts +4 -1
- package/dist/esm/api/types/ChatCompletionRequestMessage.d.mts +4 -1
- package/dist/esm/api/types/ChatCompletionRequestToolMessage.d.mts +6 -0
- package/dist/esm/api/types/ChatCompletionRequestToolMessage.mjs +2 -0
- package/dist/esm/api/types/ChatCompletionResponseMessage.d.mts +6 -1
- package/dist/esm/api/types/ChatCompletionTool.d.mts +6 -0
- package/dist/esm/api/types/ChatCompletionTool.mjs +2 -0
- package/dist/esm/api/types/Choice.d.mts +1 -0
- package/dist/esm/api/types/CompletionUsage.d.mts +2 -0
- package/dist/esm/api/types/CreateChatCompletionResponse.d.mts +2 -0
- package/dist/esm/api/types/FunctionCall.d.mts +6 -0
- package/dist/esm/api/types/FunctionCall.mjs +2 -0
- package/dist/esm/api/types/FunctionDefinition.d.mts +8 -0
- package/dist/esm/api/types/FunctionDefinition.mjs +2 -0
- package/dist/esm/api/types/SarvamModelIds.d.mts +8 -1
- package/dist/esm/api/types/SarvamModelIds.mjs +7 -1
- package/dist/esm/api/types/ToolChoiceOption.d.mts +2 -0
- package/dist/esm/api/types/ToolChoiceOption.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +8 -0
- package/dist/esm/api/types/index.mjs +8 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +3 -17
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.5-alpha.1",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.5-alpha.1",
|
|
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);
|
|
@@ -12,8 +12,6 @@ export declare class ChatClient {
|
|
|
12
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<ChatClient.Options>;
|
|
13
13
|
constructor(options?: ChatClient.Options);
|
|
14
14
|
/**
|
|
15
|
-
* Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
16
|
-
*
|
|
17
15
|
* @param {SarvamAI.ChatCompletionsRequest} request
|
|
18
16
|
* @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
17
|
*
|
|
@@ -26,9 +24,9 @@ export declare class ChatClient {
|
|
|
26
24
|
* @example
|
|
27
25
|
* await client.chat.completions({
|
|
28
26
|
* messages: [{
|
|
29
|
-
* role: "assistant"
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* role: "assistant"
|
|
28
|
+
* }],
|
|
29
|
+
* model: "sarvam-m"
|
|
32
30
|
* })
|
|
33
31
|
*/
|
|
34
32
|
completions(request: SarvamAI.ChatCompletionsRequest, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise<SarvamAI.CreateChatCompletionResponse>;
|
|
@@ -55,8 +55,6 @@ class ChatClient {
|
|
|
55
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
59
|
-
*
|
|
60
58
|
* @param {SarvamAI.ChatCompletionsRequest} request
|
|
61
59
|
* @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
60
|
*
|
|
@@ -69,9 +67,9 @@ class ChatClient {
|
|
|
69
67
|
* @example
|
|
70
68
|
* await client.chat.completions({
|
|
71
69
|
* messages: [{
|
|
72
|
-
* role: "assistant"
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* role: "assistant"
|
|
71
|
+
* }],
|
|
72
|
+
* model: "sarvam-m"
|
|
75
73
|
* })
|
|
76
74
|
*/
|
|
77
75
|
completions(request, requestOptions) {
|
|
@@ -89,7 +87,7 @@ class ChatClient {
|
|
|
89
87
|
contentType: "application/json",
|
|
90
88
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
91
89
|
requestType: "json",
|
|
92
|
-
body:
|
|
90
|
+
body: request,
|
|
93
91
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
94
92
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
95
93
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -3,14 +3,16 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* messages: [{
|
|
6
|
-
* role: "assistant"
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* role: "assistant"
|
|
7
|
+
* }],
|
|
8
|
+
* model: "sarvam-m"
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export interface ChatCompletionsRequest {
|
|
12
12
|
/** A list of messages comprising the conversation so far. */
|
|
13
13
|
messages: SarvamAI.ChatCompletionRequestMessage[];
|
|
14
|
+
/** Model ID used to generate the response, like `sarvam-m`. */
|
|
15
|
+
model: SarvamAI.SarvamModelIds;
|
|
14
16
|
/**
|
|
15
17
|
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
|
|
16
18
|
* We generally recommend altering this or `top_p` but not both.
|
|
@@ -25,6 +27,7 @@ export interface ChatCompletionsRequest {
|
|
|
25
27
|
* We generally recommend altering this or `temperature` but not both.
|
|
26
28
|
*/
|
|
27
29
|
top_p?: number;
|
|
30
|
+
/** The effort to use for reasoning */
|
|
28
31
|
reasoning_effort?: SarvamAI.ReasoningEffort;
|
|
29
32
|
/** The maximum number of tokens that can be generated in the chat completion. */
|
|
30
33
|
max_tokens?: number;
|
|
@@ -39,6 +42,7 @@ export interface ChatCompletionsRequest {
|
|
|
39
42
|
/**
|
|
40
43
|
* This feature is in Beta.
|
|
41
44
|
* If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
|
|
45
|
+
* Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
|
|
42
46
|
*/
|
|
43
47
|
seed?: number;
|
|
44
48
|
/**
|
|
@@ -53,6 +57,10 @@ export interface ChatCompletionsRequest {
|
|
|
53
57
|
* to talk about new topics.
|
|
54
58
|
*/
|
|
55
59
|
presence_penalty?: number;
|
|
56
|
-
/** If
|
|
60
|
+
/** If set to true, the model response will be wiki grounded. */
|
|
57
61
|
wiki_grounding?: boolean;
|
|
62
|
+
/** A list of tools the model may call. Currently, only functions are supported as a tool. */
|
|
63
|
+
tools?: SarvamAI.ChatCompletionTool[];
|
|
64
|
+
/** Controls which (if any) tool is called by the model. */
|
|
65
|
+
tool_choice?: SarvamAI.ToolChoiceOption;
|
|
58
66
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as SarvamAI from "../index.js";
|
|
2
|
+
export interface ChatCompletionMessageToolCall {
|
|
3
|
+
/** The ID of the tool call. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The type of the tool call, currently only `function`. */
|
|
6
|
+
type: "function";
|
|
7
|
+
function: SarvamAI.FunctionCall;
|
|
8
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type * as SarvamAI from "../index.js";
|
|
1
2
|
export interface ChatCompletionRequestAssistantMessage {
|
|
2
3
|
/** The contents of the assistant message */
|
|
3
|
-
content
|
|
4
|
+
content?: string;
|
|
5
|
+
/** The tool calls generated by the model. */
|
|
6
|
+
tool_calls?: SarvamAI.ChatCompletionMessageToolCall[];
|
|
4
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.js";
|
|
2
|
-
export type ChatCompletionRequestMessage = SarvamAI.ChatCompletionRequestMessage.Assistant | SarvamAI.ChatCompletionRequestMessage.System | SarvamAI.ChatCompletionRequestMessage.User;
|
|
2
|
+
export type ChatCompletionRequestMessage = SarvamAI.ChatCompletionRequestMessage.Assistant | SarvamAI.ChatCompletionRequestMessage.System | SarvamAI.ChatCompletionRequestMessage.Tool | SarvamAI.ChatCompletionRequestMessage.User;
|
|
3
3
|
export declare namespace ChatCompletionRequestMessage {
|
|
4
4
|
interface Assistant extends SarvamAI.ChatCompletionRequestAssistantMessage {
|
|
5
5
|
role: "assistant";
|
|
@@ -7,6 +7,9 @@ export declare namespace ChatCompletionRequestMessage {
|
|
|
7
7
|
interface System extends SarvamAI.ChatCompletionRequestSystemMessage {
|
|
8
8
|
role: "system";
|
|
9
9
|
}
|
|
10
|
+
interface Tool extends SarvamAI.ChatCompletionRequestToolMessage {
|
|
11
|
+
role: "tool";
|
|
12
|
+
}
|
|
10
13
|
interface User extends SarvamAI.ChatCompletionRequestUserMessage {
|
|
11
14
|
role: "user";
|
|
12
15
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.js";
|
|
2
2
|
export interface ChatCompletionResponseMessage {
|
|
3
3
|
/** The contents of the message. */
|
|
4
|
-
content
|
|
4
|
+
content?: string;
|
|
5
|
+
refusal?: string;
|
|
6
|
+
/** The contents of the reasoning message. */
|
|
7
|
+
reasoning_content?: string;
|
|
5
8
|
/** The role of the author of this message. */
|
|
6
9
|
role: SarvamAI.Role;
|
|
10
|
+
/** The tool calls generated by the model. */
|
|
11
|
+
tool_calls?: SarvamAI.ChatCompletionMessageToolCall[];
|
|
7
12
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface FunctionDefinition {
|
|
2
|
+
/** The name of the function to be called. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** A description of what the function does. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** The parameters the function accepts, described as a JSON Schema object. */
|
|
7
|
+
parameters?: Record<string, unknown>;
|
|
8
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const SarvamModelIds: {
|
|
2
|
+
readonly SarvamM: "sarvam-m";
|
|
3
|
+
readonly Gemma4B: "gemma-4b";
|
|
4
|
+
readonly Gemma12B: "gemma-12b";
|
|
5
|
+
readonly Sarvam30B: "sarvam-30b";
|
|
6
|
+
readonly Sarvam100B: "sarvam-100b";
|
|
7
|
+
};
|
|
8
|
+
export type SarvamModelIds = (typeof SarvamModelIds)[keyof typeof SarvamModelIds];
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SarvamModelIds = void 0;
|
|
5
|
+
exports.SarvamModelIds = {
|
|
6
|
+
SarvamM: "sarvam-m",
|
|
7
|
+
Gemma4B: "gemma-4b",
|
|
8
|
+
Gemma12B: "gemma-12b",
|
|
9
|
+
Sarvam30B: "sarvam-30b",
|
|
10
|
+
Sarvam100B: "sarvam-100b",
|
|
11
|
+
};
|
|
@@ -4,11 +4,16 @@ export * from "./AudioOutput.js";
|
|
|
4
4
|
export * from "./BaseJobParameters.js";
|
|
5
5
|
export * from "./BulkJobCallback.js";
|
|
6
6
|
export * from "./BulkJobInitResponseV1.js";
|
|
7
|
+
export * from "./ChatCompletionMessageToolCall.js";
|
|
8
|
+
export * from "./ChatCompletionNamedToolChoice.js";
|
|
9
|
+
export * from "./ChatCompletionNamedToolChoiceFunction.js";
|
|
7
10
|
export * from "./ChatCompletionRequestAssistantMessage.js";
|
|
8
11
|
export * from "./ChatCompletionRequestMessage.js";
|
|
9
12
|
export * from "./ChatCompletionRequestSystemMessage.js";
|
|
13
|
+
export * from "./ChatCompletionRequestToolMessage.js";
|
|
10
14
|
export * from "./ChatCompletionRequestUserMessage.js";
|
|
11
15
|
export * from "./ChatCompletionResponseMessage.js";
|
|
16
|
+
export * from "./ChatCompletionTool.js";
|
|
12
17
|
export * from "./Choice.js";
|
|
13
18
|
export * from "./CompletionEventFlag.js";
|
|
14
19
|
export * from "./CompletionUsage.js";
|
|
@@ -46,6 +51,8 @@ export * from "./FilesRequest.js";
|
|
|
46
51
|
export * from "./FilesUploadResponse.js";
|
|
47
52
|
export * from "./FinishReason.js";
|
|
48
53
|
export * from "./FlushSignal.js";
|
|
54
|
+
export * from "./FunctionCall.js";
|
|
55
|
+
export * from "./FunctionDefinition.js";
|
|
49
56
|
export * from "./InputAudioCodec.js";
|
|
50
57
|
export * from "./JobState.js";
|
|
51
58
|
export * from "./JobStatusV1Response.js";
|
|
@@ -86,6 +93,7 @@ export * from "./TextToSpeechOutputAudioCodec.js";
|
|
|
86
93
|
export * from "./TextToSpeechResponse.js";
|
|
87
94
|
export * from "./TextToSpeechSpeaker.js";
|
|
88
95
|
export * from "./TimestampsModel.js";
|
|
96
|
+
export * from "./ToolChoiceOption.js";
|
|
89
97
|
export * from "./TranscriptionMetrics.js";
|
|
90
98
|
export * from "./TranslateMode.js";
|
|
91
99
|
export * from "./TranslateModel.js";
|
|
@@ -20,11 +20,16 @@ __exportStar(require("./AudioOutput.js"), exports);
|
|
|
20
20
|
__exportStar(require("./BaseJobParameters.js"), exports);
|
|
21
21
|
__exportStar(require("./BulkJobCallback.js"), exports);
|
|
22
22
|
__exportStar(require("./BulkJobInitResponseV1.js"), exports);
|
|
23
|
+
__exportStar(require("./ChatCompletionMessageToolCall.js"), exports);
|
|
24
|
+
__exportStar(require("./ChatCompletionNamedToolChoice.js"), exports);
|
|
25
|
+
__exportStar(require("./ChatCompletionNamedToolChoiceFunction.js"), exports);
|
|
23
26
|
__exportStar(require("./ChatCompletionRequestAssistantMessage.js"), exports);
|
|
24
27
|
__exportStar(require("./ChatCompletionRequestMessage.js"), exports);
|
|
25
28
|
__exportStar(require("./ChatCompletionRequestSystemMessage.js"), exports);
|
|
29
|
+
__exportStar(require("./ChatCompletionRequestToolMessage.js"), exports);
|
|
26
30
|
__exportStar(require("./ChatCompletionRequestUserMessage.js"), exports);
|
|
27
31
|
__exportStar(require("./ChatCompletionResponseMessage.js"), exports);
|
|
32
|
+
__exportStar(require("./ChatCompletionTool.js"), exports);
|
|
28
33
|
__exportStar(require("./Choice.js"), exports);
|
|
29
34
|
__exportStar(require("./CompletionEventFlag.js"), exports);
|
|
30
35
|
__exportStar(require("./CompletionUsage.js"), exports);
|
|
@@ -62,6 +67,8 @@ __exportStar(require("./FilesRequest.js"), exports);
|
|
|
62
67
|
__exportStar(require("./FilesUploadResponse.js"), exports);
|
|
63
68
|
__exportStar(require("./FinishReason.js"), exports);
|
|
64
69
|
__exportStar(require("./FlushSignal.js"), exports);
|
|
70
|
+
__exportStar(require("./FunctionCall.js"), exports);
|
|
71
|
+
__exportStar(require("./FunctionDefinition.js"), exports);
|
|
65
72
|
__exportStar(require("./InputAudioCodec.js"), exports);
|
|
66
73
|
__exportStar(require("./JobState.js"), exports);
|
|
67
74
|
__exportStar(require("./JobStatusV1Response.js"), exports);
|
|
@@ -102,6 +109,7 @@ __exportStar(require("./TextToSpeechOutputAudioCodec.js"), exports);
|
|
|
102
109
|
__exportStar(require("./TextToSpeechResponse.js"), exports);
|
|
103
110
|
__exportStar(require("./TextToSpeechSpeaker.js"), exports);
|
|
104
111
|
__exportStar(require("./TimestampsModel.js"), exports);
|
|
112
|
+
__exportStar(require("./ToolChoiceOption.js"), exports);
|
|
105
113
|
__exportStar(require("./TranscriptionMetrics.js"), exports);
|
|
106
114
|
__exportStar(require("./TranslateMode.js"), exports);
|
|
107
115
|
__exportStar(require("./TranslateModel.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.5-alpha.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "sarvamai",
|
|
9
|
-
"X-Fern-SDK-Version": "1.1.
|
|
10
|
-
"User-Agent": "sarvamai/1.1.
|
|
9
|
+
"X-Fern-SDK-Version": "1.1.5-alpha.1",
|
|
10
|
+
"User-Agent": "sarvamai/1.1.5-alpha.1",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -12,8 +12,6 @@ export declare class ChatClient {
|
|
|
12
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<ChatClient.Options>;
|
|
13
13
|
constructor(options?: ChatClient.Options);
|
|
14
14
|
/**
|
|
15
|
-
* Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
16
|
-
*
|
|
17
15
|
* @param {SarvamAI.ChatCompletionsRequest} request
|
|
18
16
|
* @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
17
|
*
|
|
@@ -26,9 +24,9 @@ export declare class ChatClient {
|
|
|
26
24
|
* @example
|
|
27
25
|
* await client.chat.completions({
|
|
28
26
|
* messages: [{
|
|
29
|
-
* role: "assistant"
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* role: "assistant"
|
|
28
|
+
* }],
|
|
29
|
+
* model: "sarvam-m"
|
|
32
30
|
* })
|
|
33
31
|
*/
|
|
34
32
|
completions(request: SarvamAI.ChatCompletionsRequest, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise<SarvamAI.CreateChatCompletionResponse>;
|
|
@@ -19,8 +19,6 @@ export class ChatClient {
|
|
|
19
19
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
23
|
-
*
|
|
24
22
|
* @param {SarvamAI.ChatCompletionsRequest} request
|
|
25
23
|
* @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
24
|
*
|
|
@@ -33,9 +31,9 @@ export class ChatClient {
|
|
|
33
31
|
* @example
|
|
34
32
|
* await client.chat.completions({
|
|
35
33
|
* messages: [{
|
|
36
|
-
* role: "assistant"
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* role: "assistant"
|
|
35
|
+
* }],
|
|
36
|
+
* model: "sarvam-m"
|
|
39
37
|
* })
|
|
40
38
|
*/
|
|
41
39
|
completions(request, requestOptions) {
|
|
@@ -53,7 +51,7 @@ export class ChatClient {
|
|
|
53
51
|
contentType: "application/json",
|
|
54
52
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
55
53
|
requestType: "json",
|
|
56
|
-
body:
|
|
54
|
+
body: request,
|
|
57
55
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
58
56
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
59
57
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -3,14 +3,16 @@ import type * as SarvamAI from "../../../../index.mjs";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* messages: [{
|
|
6
|
-
* role: "assistant"
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* role: "assistant"
|
|
7
|
+
* }],
|
|
8
|
+
* model: "sarvam-m"
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export interface ChatCompletionsRequest {
|
|
12
12
|
/** A list of messages comprising the conversation so far. */
|
|
13
13
|
messages: SarvamAI.ChatCompletionRequestMessage[];
|
|
14
|
+
/** Model ID used to generate the response, like `sarvam-m`. */
|
|
15
|
+
model: SarvamAI.SarvamModelIds;
|
|
14
16
|
/**
|
|
15
17
|
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
|
|
16
18
|
* We generally recommend altering this or `top_p` but not both.
|
|
@@ -25,6 +27,7 @@ export interface ChatCompletionsRequest {
|
|
|
25
27
|
* We generally recommend altering this or `temperature` but not both.
|
|
26
28
|
*/
|
|
27
29
|
top_p?: number;
|
|
30
|
+
/** The effort to use for reasoning */
|
|
28
31
|
reasoning_effort?: SarvamAI.ReasoningEffort;
|
|
29
32
|
/** The maximum number of tokens that can be generated in the chat completion. */
|
|
30
33
|
max_tokens?: number;
|
|
@@ -39,6 +42,7 @@ export interface ChatCompletionsRequest {
|
|
|
39
42
|
/**
|
|
40
43
|
* This feature is in Beta.
|
|
41
44
|
* If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
|
|
45
|
+
* Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
|
|
42
46
|
*/
|
|
43
47
|
seed?: number;
|
|
44
48
|
/**
|
|
@@ -53,6 +57,10 @@ export interface ChatCompletionsRequest {
|
|
|
53
57
|
* to talk about new topics.
|
|
54
58
|
*/
|
|
55
59
|
presence_penalty?: number;
|
|
56
|
-
/** If
|
|
60
|
+
/** If set to true, the model response will be wiki grounded. */
|
|
57
61
|
wiki_grounding?: boolean;
|
|
62
|
+
/** A list of tools the model may call. Currently, only functions are supported as a tool. */
|
|
63
|
+
tools?: SarvamAI.ChatCompletionTool[];
|
|
64
|
+
/** Controls which (if any) tool is called by the model. */
|
|
65
|
+
tool_choice?: SarvamAI.ToolChoiceOption;
|
|
58
66
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as SarvamAI from "../index.mjs";
|
|
2
|
+
export interface ChatCompletionMessageToolCall {
|
|
3
|
+
/** The ID of the tool call. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The type of the tool call, currently only `function`. */
|
|
6
|
+
type: "function";
|
|
7
|
+
function: SarvamAI.FunctionCall;
|
|
8
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type * as SarvamAI from "../index.mjs";
|
|
1
2
|
export interface ChatCompletionRequestAssistantMessage {
|
|
2
3
|
/** The contents of the assistant message */
|
|
3
|
-
content
|
|
4
|
+
content?: string;
|
|
5
|
+
/** The tool calls generated by the model. */
|
|
6
|
+
tool_calls?: SarvamAI.ChatCompletionMessageToolCall[];
|
|
4
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.mjs";
|
|
2
|
-
export type ChatCompletionRequestMessage = SarvamAI.ChatCompletionRequestMessage.Assistant | SarvamAI.ChatCompletionRequestMessage.System | SarvamAI.ChatCompletionRequestMessage.User;
|
|
2
|
+
export type ChatCompletionRequestMessage = SarvamAI.ChatCompletionRequestMessage.Assistant | SarvamAI.ChatCompletionRequestMessage.System | SarvamAI.ChatCompletionRequestMessage.Tool | SarvamAI.ChatCompletionRequestMessage.User;
|
|
3
3
|
export declare namespace ChatCompletionRequestMessage {
|
|
4
4
|
interface Assistant extends SarvamAI.ChatCompletionRequestAssistantMessage {
|
|
5
5
|
role: "assistant";
|
|
@@ -7,6 +7,9 @@ export declare namespace ChatCompletionRequestMessage {
|
|
|
7
7
|
interface System extends SarvamAI.ChatCompletionRequestSystemMessage {
|
|
8
8
|
role: "system";
|
|
9
9
|
}
|
|
10
|
+
interface Tool extends SarvamAI.ChatCompletionRequestToolMessage {
|
|
11
|
+
role: "tool";
|
|
12
|
+
}
|
|
10
13
|
interface User extends SarvamAI.ChatCompletionRequestUserMessage {
|
|
11
14
|
role: "user";
|
|
12
15
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.mjs";
|
|
2
2
|
export interface ChatCompletionResponseMessage {
|
|
3
3
|
/** The contents of the message. */
|
|
4
|
-
content
|
|
4
|
+
content?: string;
|
|
5
|
+
refusal?: string;
|
|
6
|
+
/** The contents of the reasoning message. */
|
|
7
|
+
reasoning_content?: string;
|
|
5
8
|
/** The role of the author of this message. */
|
|
6
9
|
role: SarvamAI.Role;
|
|
10
|
+
/** The tool calls generated by the model. */
|
|
11
|
+
tool_calls?: SarvamAI.ChatCompletionMessageToolCall[];
|
|
7
12
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface FunctionDefinition {
|
|
2
|
+
/** The name of the function to be called. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** A description of what the function does. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** The parameters the function accepts, described as a JSON Schema object. */
|
|
7
|
+
parameters?: Record<string, unknown>;
|
|
8
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const SarvamModelIds: {
|
|
2
|
+
readonly SarvamM: "sarvam-m";
|
|
3
|
+
readonly Gemma4B: "gemma-4b";
|
|
4
|
+
readonly Gemma12B: "gemma-12b";
|
|
5
|
+
readonly Sarvam30B: "sarvam-30b";
|
|
6
|
+
readonly Sarvam100B: "sarvam-100b";
|
|
7
|
+
};
|
|
8
|
+
export type SarvamModelIds = (typeof SarvamModelIds)[keyof typeof SarvamModelIds];
|
|
@@ -4,11 +4,16 @@ export * from "./AudioOutput.mjs";
|
|
|
4
4
|
export * from "./BaseJobParameters.mjs";
|
|
5
5
|
export * from "./BulkJobCallback.mjs";
|
|
6
6
|
export * from "./BulkJobInitResponseV1.mjs";
|
|
7
|
+
export * from "./ChatCompletionMessageToolCall.mjs";
|
|
8
|
+
export * from "./ChatCompletionNamedToolChoice.mjs";
|
|
9
|
+
export * from "./ChatCompletionNamedToolChoiceFunction.mjs";
|
|
7
10
|
export * from "./ChatCompletionRequestAssistantMessage.mjs";
|
|
8
11
|
export * from "./ChatCompletionRequestMessage.mjs";
|
|
9
12
|
export * from "./ChatCompletionRequestSystemMessage.mjs";
|
|
13
|
+
export * from "./ChatCompletionRequestToolMessage.mjs";
|
|
10
14
|
export * from "./ChatCompletionRequestUserMessage.mjs";
|
|
11
15
|
export * from "./ChatCompletionResponseMessage.mjs";
|
|
16
|
+
export * from "./ChatCompletionTool.mjs";
|
|
12
17
|
export * from "./Choice.mjs";
|
|
13
18
|
export * from "./CompletionEventFlag.mjs";
|
|
14
19
|
export * from "./CompletionUsage.mjs";
|
|
@@ -46,6 +51,8 @@ export * from "./FilesRequest.mjs";
|
|
|
46
51
|
export * from "./FilesUploadResponse.mjs";
|
|
47
52
|
export * from "./FinishReason.mjs";
|
|
48
53
|
export * from "./FlushSignal.mjs";
|
|
54
|
+
export * from "./FunctionCall.mjs";
|
|
55
|
+
export * from "./FunctionDefinition.mjs";
|
|
49
56
|
export * from "./InputAudioCodec.mjs";
|
|
50
57
|
export * from "./JobState.mjs";
|
|
51
58
|
export * from "./JobStatusV1Response.mjs";
|
|
@@ -86,6 +93,7 @@ export * from "./TextToSpeechOutputAudioCodec.mjs";
|
|
|
86
93
|
export * from "./TextToSpeechResponse.mjs";
|
|
87
94
|
export * from "./TextToSpeechSpeaker.mjs";
|
|
88
95
|
export * from "./TimestampsModel.mjs";
|
|
96
|
+
export * from "./ToolChoiceOption.mjs";
|
|
89
97
|
export * from "./TranscriptionMetrics.mjs";
|
|
90
98
|
export * from "./TranslateMode.mjs";
|
|
91
99
|
export * from "./TranslateModel.mjs";
|
|
@@ -4,11 +4,16 @@ export * from "./AudioOutput.mjs";
|
|
|
4
4
|
export * from "./BaseJobParameters.mjs";
|
|
5
5
|
export * from "./BulkJobCallback.mjs";
|
|
6
6
|
export * from "./BulkJobInitResponseV1.mjs";
|
|
7
|
+
export * from "./ChatCompletionMessageToolCall.mjs";
|
|
8
|
+
export * from "./ChatCompletionNamedToolChoice.mjs";
|
|
9
|
+
export * from "./ChatCompletionNamedToolChoiceFunction.mjs";
|
|
7
10
|
export * from "./ChatCompletionRequestAssistantMessage.mjs";
|
|
8
11
|
export * from "./ChatCompletionRequestMessage.mjs";
|
|
9
12
|
export * from "./ChatCompletionRequestSystemMessage.mjs";
|
|
13
|
+
export * from "./ChatCompletionRequestToolMessage.mjs";
|
|
10
14
|
export * from "./ChatCompletionRequestUserMessage.mjs";
|
|
11
15
|
export * from "./ChatCompletionResponseMessage.mjs";
|
|
16
|
+
export * from "./ChatCompletionTool.mjs";
|
|
12
17
|
export * from "./Choice.mjs";
|
|
13
18
|
export * from "./CompletionEventFlag.mjs";
|
|
14
19
|
export * from "./CompletionUsage.mjs";
|
|
@@ -46,6 +51,8 @@ export * from "./FilesRequest.mjs";
|
|
|
46
51
|
export * from "./FilesUploadResponse.mjs";
|
|
47
52
|
export * from "./FinishReason.mjs";
|
|
48
53
|
export * from "./FlushSignal.mjs";
|
|
54
|
+
export * from "./FunctionCall.mjs";
|
|
55
|
+
export * from "./FunctionDefinition.mjs";
|
|
49
56
|
export * from "./InputAudioCodec.mjs";
|
|
50
57
|
export * from "./JobState.mjs";
|
|
51
58
|
export * from "./JobStatusV1Response.mjs";
|
|
@@ -86,6 +93,7 @@ export * from "./TextToSpeechOutputAudioCodec.mjs";
|
|
|
86
93
|
export * from "./TextToSpeechResponse.mjs";
|
|
87
94
|
export * from "./TextToSpeechSpeaker.mjs";
|
|
88
95
|
export * from "./TimestampsModel.mjs";
|
|
96
|
+
export * from "./ToolChoiceOption.mjs";
|
|
89
97
|
export * from "./TranscriptionMetrics.mjs";
|
|
90
98
|
export * from "./TranslateMode.mjs";
|
|
91
99
|
export * from "./TranslateModel.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.5-alpha.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.1.
|
|
1
|
+
export const SDK_VERSION = "1.1.5-alpha.1";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -489,20 +489,6 @@ await client.textToSpeech.convert({
|
|
|
489
489
|
<dl>
|
|
490
490
|
<dd>
|
|
491
491
|
|
|
492
|
-
#### 📝 Description
|
|
493
|
-
|
|
494
|
-
<dl>
|
|
495
|
-
<dd>
|
|
496
|
-
|
|
497
|
-
<dl>
|
|
498
|
-
<dd>
|
|
499
|
-
|
|
500
|
-
Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
501
|
-
</dd>
|
|
502
|
-
</dl>
|
|
503
|
-
</dd>
|
|
504
|
-
</dl>
|
|
505
|
-
|
|
506
492
|
#### 🔌 Usage
|
|
507
493
|
|
|
508
494
|
<dl>
|
|
@@ -514,9 +500,9 @@ Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
|
514
500
|
```typescript
|
|
515
501
|
await client.chat.completions({
|
|
516
502
|
messages: [{
|
|
517
|
-
role: "assistant"
|
|
518
|
-
|
|
519
|
-
|
|
503
|
+
role: "assistant"
|
|
504
|
+
}],
|
|
505
|
+
model: "sarvam-m"
|
|
520
506
|
});
|
|
521
507
|
|
|
522
508
|
```
|