sarvamai 0.1.0 → 0.1.2

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.
Files changed (111) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +5 -0
  3. package/README.md +1 -1
  4. package/api/errors/ForbiddenError.d.ts +1 -2
  5. package/api/errors/TooManyRequestsError.d.ts +1 -2
  6. package/api/resources/chat/client/Client.d.ts +53 -0
  7. package/api/resources/chat/client/Client.js +141 -0
  8. package/api/resources/chat/client/index.d.ts +1 -0
  9. package/api/resources/chat/client/index.js +17 -0
  10. package/api/resources/chat/client/requests/ChatCompletionsRequest.d.ts +63 -0
  11. package/api/resources/chat/client/requests/ChatCompletionsRequest.js +5 -0
  12. package/api/resources/chat/client/requests/index.d.ts +1 -0
  13. package/api/resources/chat/client/requests/index.js +2 -0
  14. package/api/resources/chat/index.d.ts +1 -0
  15. package/api/resources/chat/index.js +17 -0
  16. package/api/resources/index.d.ts +2 -0
  17. package/api/resources/index.js +3 -1
  18. package/api/resources/speechToText/client/Client.js +2 -2
  19. package/api/resources/text/client/Client.js +3 -3
  20. package/api/resources/textToSpeech/client/Client.d.ts +1 -1
  21. package/api/resources/textToSpeech/client/Client.js +2 -2
  22. package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +2 -14
  23. package/api/types/ChatCompletionRequestAssistantMessage.d.ts +7 -0
  24. package/api/types/ChatCompletionRequestAssistantMessage.js +5 -0
  25. package/api/types/ChatCompletionRequestMessage.d.ts +16 -0
  26. package/api/types/ChatCompletionRequestMessage.js +5 -0
  27. package/api/types/ChatCompletionRequestSystemMessage.d.ts +7 -0
  28. package/api/types/ChatCompletionRequestSystemMessage.js +5 -0
  29. package/api/types/ChatCompletionRequestUserMessage.d.ts +7 -0
  30. package/api/types/ChatCompletionRequestUserMessage.js +5 -0
  31. package/api/types/ChatCompletionResponseMessage.d.ts +10 -0
  32. package/api/types/ChatCompletionResponseMessage.js +5 -0
  33. package/api/types/Choice.d.ts +16 -0
  34. package/api/types/Choice.js +5 -0
  35. package/api/types/CompletionUsage.d.ts +11 -0
  36. package/api/types/CompletionUsage.js +5 -0
  37. package/api/types/CreateChatCompletionResponse.d.ts +17 -0
  38. package/api/types/CreateChatCompletionResponse.js +5 -0
  39. package/api/types/ErrorCode.d.ts +4 -4
  40. package/api/types/ErrorCode.js +3 -3
  41. package/api/types/ErrorDetails.d.ts +2 -0
  42. package/api/types/FinishReason.d.ts +11 -0
  43. package/api/types/FinishReason.js +13 -0
  44. package/api/types/ReasoningEffort.d.ts +9 -0
  45. package/api/types/ReasoningEffort.js +11 -0
  46. package/api/types/Role.d.ts +4 -0
  47. package/api/types/Role.js +5 -0
  48. package/api/types/SarvamModelIds.d.ts +4 -0
  49. package/api/types/SarvamModelIds.js +5 -0
  50. package/api/types/StopConfiguration.d.ts +8 -0
  51. package/api/types/StopConfiguration.js +5 -0
  52. package/api/types/index.d.ts +13 -0
  53. package/api/types/index.js +13 -0
  54. package/dist/Client.d.ts +3 -0
  55. package/dist/Client.js +5 -0
  56. package/dist/api/errors/ForbiddenError.d.ts +1 -2
  57. package/dist/api/errors/TooManyRequestsError.d.ts +1 -2
  58. package/dist/api/resources/chat/client/Client.d.ts +53 -0
  59. package/dist/api/resources/chat/client/Client.js +141 -0
  60. package/dist/api/resources/chat/client/index.d.ts +1 -0
  61. package/dist/api/resources/chat/client/index.js +17 -0
  62. package/dist/api/resources/chat/client/requests/ChatCompletionsRequest.d.ts +63 -0
  63. package/dist/api/resources/chat/client/requests/ChatCompletionsRequest.js +5 -0
  64. package/dist/api/resources/chat/client/requests/index.d.ts +1 -0
  65. package/dist/api/resources/chat/client/requests/index.js +2 -0
  66. package/dist/api/resources/chat/index.d.ts +1 -0
  67. package/dist/api/resources/chat/index.js +17 -0
  68. package/dist/api/resources/index.d.ts +2 -0
  69. package/dist/api/resources/index.js +3 -1
  70. package/dist/api/resources/speechToText/client/Client.js +2 -2
  71. package/dist/api/resources/text/client/Client.js +3 -3
  72. package/dist/api/resources/textToSpeech/client/Client.d.ts +1 -1
  73. package/dist/api/resources/textToSpeech/client/Client.js +2 -2
  74. package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +2 -14
  75. package/dist/api/types/ChatCompletionRequestAssistantMessage.d.ts +7 -0
  76. package/dist/api/types/ChatCompletionRequestAssistantMessage.js +5 -0
  77. package/dist/api/types/ChatCompletionRequestMessage.d.ts +16 -0
  78. package/dist/api/types/ChatCompletionRequestMessage.js +5 -0
  79. package/dist/api/types/ChatCompletionRequestSystemMessage.d.ts +7 -0
  80. package/dist/api/types/ChatCompletionRequestSystemMessage.js +5 -0
  81. package/dist/api/types/ChatCompletionRequestUserMessage.d.ts +7 -0
  82. package/dist/api/types/ChatCompletionRequestUserMessage.js +5 -0
  83. package/dist/api/types/ChatCompletionResponseMessage.d.ts +10 -0
  84. package/dist/api/types/ChatCompletionResponseMessage.js +5 -0
  85. package/dist/api/types/Choice.d.ts +16 -0
  86. package/dist/api/types/Choice.js +5 -0
  87. package/dist/api/types/CompletionUsage.d.ts +11 -0
  88. package/dist/api/types/CompletionUsage.js +5 -0
  89. package/dist/api/types/CreateChatCompletionResponse.d.ts +17 -0
  90. package/dist/api/types/CreateChatCompletionResponse.js +5 -0
  91. package/dist/api/types/ErrorCode.d.ts +4 -4
  92. package/dist/api/types/ErrorCode.js +3 -3
  93. package/dist/api/types/ErrorDetails.d.ts +2 -0
  94. package/dist/api/types/FinishReason.d.ts +11 -0
  95. package/dist/api/types/FinishReason.js +13 -0
  96. package/dist/api/types/ReasoningEffort.d.ts +9 -0
  97. package/dist/api/types/ReasoningEffort.js +11 -0
  98. package/dist/api/types/Role.d.ts +4 -0
  99. package/dist/api/types/Role.js +5 -0
  100. package/dist/api/types/SarvamModelIds.d.ts +4 -0
  101. package/dist/api/types/SarvamModelIds.js +5 -0
  102. package/dist/api/types/StopConfiguration.d.ts +8 -0
  103. package/dist/api/types/StopConfiguration.js +5 -0
  104. package/dist/api/types/index.d.ts +13 -0
  105. package/dist/api/types/index.js +13 -0
  106. package/dist/version.d.ts +1 -1
  107. package/dist/version.js +1 -1
  108. package/package.json +1 -1
  109. package/reference.md +74 -1
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
@@ -99,7 +99,7 @@ class Text {
99
99
  const _response = yield core.fetcher({
100
100
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "translate"),
101
101
  method: "POST",
102
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.0", "User-Agent": "sarvamai/0.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
102
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.2", "User-Agent": "sarvamai/0.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
103
103
  contentType: "application/json",
104
104
  requestType: "json",
105
105
  body: request,
@@ -167,7 +167,7 @@ class Text {
167
167
  const _response = yield core.fetcher({
168
168
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "text-lid"),
169
169
  method: "POST",
170
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.0", "User-Agent": "sarvamai/0.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
170
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.2", "User-Agent": "sarvamai/0.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
171
171
  contentType: "application/json",
172
172
  requestType: "json",
173
173
  body: request,
@@ -259,7 +259,7 @@ class Text {
259
259
  const _response = yield core.fetcher({
260
260
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "transliterate"),
261
261
  method: "POST",
262
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.0", "User-Agent": "sarvamai/0.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
262
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.2", "User-Agent": "sarvamai/0.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
263
263
  contentType: "application/json",
264
264
  requestType: "json",
265
265
  body: request,
@@ -40,7 +40,7 @@ export declare class TextToSpeech {
40
40
  *
41
41
  * @example
42
42
  * await client.textToSpeech.convert({
43
- * inputs: ["inputs"],
43
+ * text: "text",
44
44
  * target_language_code: "bn-IN"
45
45
  * })
46
46
  */
@@ -73,7 +73,7 @@ class TextToSpeech {
73
73
  *
74
74
  * @example
75
75
  * await client.textToSpeech.convert({
76
- * inputs: ["inputs"],
76
+ * text: "text",
77
77
  * target_language_code: "bn-IN"
78
78
  * })
79
79
  */
@@ -83,7 +83,7 @@ class TextToSpeech {
83
83
  const _response = yield core.fetcher({
84
84
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "text-to-speech"),
85
85
  method: "POST",
86
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.0", "User-Agent": "sarvamai/0.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
86
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.1.2", "User-Agent": "sarvamai/0.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
87
87
  contentType: "application/json",
88
88
  requestType: "json",
89
89
  body: request,
@@ -5,24 +5,12 @@ import * as SarvamAI from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * inputs: ["inputs"],
8
+ * text: "text",
9
9
  * target_language_code: "bn-IN"
10
10
  * }
11
11
  */
12
12
  export interface TextToSpeechRequest {
13
- /**
14
- * The text(s) to be converted into speech.
15
- *
16
- * **Features:**
17
- * - Each text should be no longer than 500 characters
18
- * - You can send up to 3 texts in a single API call
19
- * - Supports code-mixed text (English and Indic languages)
20
- *
21
- * **Important Note:**
22
- * - For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
23
- * - This ensures proper pronunciation as a whole number
24
- */
25
- inputs: string[];
13
+ text: string;
26
14
  /** The language of the text is BCP-47 format */
27
15
  target_language_code: SarvamAI.TextToSpeechLanguage;
28
16
  /**
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChatCompletionRequestAssistantMessage {
5
+ /** The contents of the assistant message */
6
+ content: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as SarvamAI from "../index";
5
+ export type ChatCompletionRequestMessage = SarvamAI.ChatCompletionRequestMessage.Assistant | SarvamAI.ChatCompletionRequestMessage.System | SarvamAI.ChatCompletionRequestMessage.User;
6
+ export declare namespace ChatCompletionRequestMessage {
7
+ interface Assistant extends SarvamAI.ChatCompletionRequestAssistantMessage {
8
+ role: "assistant";
9
+ }
10
+ interface System extends SarvamAI.ChatCompletionRequestSystemMessage {
11
+ role: "system";
12
+ }
13
+ interface User extends SarvamAI.ChatCompletionRequestUserMessage {
14
+ role: "user";
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChatCompletionRequestSystemMessage {
5
+ /** The contents of the system message. */
6
+ content: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChatCompletionRequestUserMessage {
5
+ /** The contents of the user message. */
6
+ content: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as SarvamAI from "../index";
5
+ export interface ChatCompletionResponseMessage {
6
+ /** The contents of the message. */
7
+ content: string;
8
+ /** The role of the author of this message. */
9
+ role: SarvamAI.Role;
10
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as SarvamAI from "../index";
5
+ export interface Choice {
6
+ /**
7
+ * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
8
+ * `length` if the maximum number of tokens specified in the request was reached,
9
+ * `content_filter` if content was omitted due to a flag from our content filters,
10
+ * `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
11
+ */
12
+ finish_reason: SarvamAI.FinishReason;
13
+ /** The index of the choice in the list of choices. */
14
+ index: number;
15
+ message: SarvamAI.ChatCompletionResponseMessage;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CompletionUsage {
5
+ /** Number of tokens in the generated completion. */
6
+ completion_tokens: number;
7
+ /** Number of tokens in the prompt. */
8
+ prompt_tokens: number;
9
+ /** Total number of tokens used in the request (prompt + completion). */
10
+ total_tokens: number;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as SarvamAI from "../index";
5
+ export interface CreateChatCompletionResponse {
6
+ /** A unique identifier for the chat completion. */
7
+ id: string;
8
+ /** A list of chat completion choices. Can be more than one if `n` is greater than 1. */
9
+ choices: SarvamAI.Choice[];
10
+ /** The Unix timestamp (in seconds) of when the chat completion was created. */
11
+ created: number;
12
+ /** The model used for the chat completion. */
13
+ model: string;
14
+ /** The object type, which is always `chat.completion`. */
15
+ object: "chat.completion";
16
+ usage?: SarvamAI.CompletionUsage;
17
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export type ErrorCode = "invalid_request_error" | "internal_server_error" | "unprocessable_entity_error" | "not_found_error" | "insufficient_quota_error" | "rate_limit_exceeded_error" | "invalid_api_key_error" | "high_load_error";
4
+ export type ErrorCode = "invalid_request_error" | "internal_server_error" | "unprocessable_entity_error" | "insufficient_quota_error" | "invalid_api_key_error" | "authentication_error" | "rate_limit_exceeded_error" | "not_found_error";
5
5
  export declare const ErrorCode: {
6
6
  readonly InvalidRequestError: "invalid_request_error";
7
7
  readonly InternalServerError: "internal_server_error";
8
8
  readonly UnprocessableEntityError: "unprocessable_entity_error";
9
- readonly NotFoundError: "not_found_error";
10
9
  readonly InsufficientQuotaError: "insufficient_quota_error";
11
- readonly RateLimitExceededError: "rate_limit_exceeded_error";
12
10
  readonly InvalidApiKeyError: "invalid_api_key_error";
13
- readonly HighLoadError: "high_load_error";
11
+ readonly AuthenticationError: "authentication_error";
12
+ readonly RateLimitExceededError: "rate_limit_exceeded_error";
13
+ readonly NotFoundError: "not_found_error";
14
14
  };
@@ -8,9 +8,9 @@ exports.ErrorCode = {
8
8
  InvalidRequestError: "invalid_request_error",
9
9
  InternalServerError: "internal_server_error",
10
10
  UnprocessableEntityError: "unprocessable_entity_error",
11
- NotFoundError: "not_found_error",
12
11
  InsufficientQuotaError: "insufficient_quota_error",
13
- RateLimitExceededError: "rate_limit_exceeded_error",
14
12
  InvalidApiKeyError: "invalid_api_key_error",
15
- HighLoadError: "high_load_error",
13
+ AuthenticationError: "authentication_error",
14
+ RateLimitExceededError: "rate_limit_exceeded_error",
15
+ NotFoundError: "not_found_error",
16
16
  };
@@ -7,4 +7,6 @@ export interface ErrorDetails {
7
7
  message: string;
8
8
  /** Error code for the specific error that has occured. Refer to the error code documentation for more details. */
9
9
  code: SarvamAI.ErrorCode;
10
+ /** Unique identifier for the request. Format: date_UUID4 */
11
+ request_id?: string;
10
12
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
5
+ export declare const FinishReason: {
6
+ readonly Stop: "stop";
7
+ readonly Length: "length";
8
+ readonly ToolCalls: "tool_calls";
9
+ readonly ContentFilter: "content_filter";
10
+ readonly FunctionCall: "function_call";
11
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FinishReason = void 0;
7
+ exports.FinishReason = {
8
+ Stop: "stop",
9
+ Length: "length",
10
+ ToolCalls: "tool_calls",
11
+ ContentFilter: "content_filter",
12
+ FunctionCall: "function_call",
13
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ReasoningEffort = "low" | "medium" | "high";
5
+ export declare const ReasoningEffort: {
6
+ readonly Low: "low";
7
+ readonly Medium: "medium";
8
+ readonly High: "high";
9
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ReasoningEffort = void 0;
7
+ exports.ReasoningEffort = {
8
+ Low: "low",
9
+ Medium: "medium",
10
+ High: "high",
11
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type Role = "assistant";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type SarvamModelIds = "sarvam-m";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Up to 4 sequences where the API will stop generating further tokens. The
6
+ * returned text will not contain the stop sequence.
7
+ */
8
+ export type StopConfiguration = string | string[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,16 @@
1
+ export * from "./ChatCompletionRequestAssistantMessage";
2
+ export * from "./ChatCompletionRequestMessage";
3
+ export * from "./ChatCompletionRequestSystemMessage";
4
+ export * from "./ChatCompletionRequestUserMessage";
5
+ export * from "./ChatCompletionResponseMessage";
6
+ export * from "./Choice";
7
+ export * from "./CompletionUsage";
8
+ export * from "./CreateChatCompletionResponse";
9
+ export * from "./FinishReason";
10
+ export * from "./ReasoningEffort";
11
+ export * from "./Role";
12
+ export * from "./SarvamModelIds";
13
+ export * from "./StopConfiguration";
1
14
  export * from "./ErrorCode";
2
15
  export * from "./ErrorDetails";
3
16
  export * from "./ErrorMessage";
@@ -14,6 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ChatCompletionRequestAssistantMessage"), exports);
18
+ __exportStar(require("./ChatCompletionRequestMessage"), exports);
19
+ __exportStar(require("./ChatCompletionRequestSystemMessage"), exports);
20
+ __exportStar(require("./ChatCompletionRequestUserMessage"), exports);
21
+ __exportStar(require("./ChatCompletionResponseMessage"), exports);
22
+ __exportStar(require("./Choice"), exports);
23
+ __exportStar(require("./CompletionUsage"), exports);
24
+ __exportStar(require("./CreateChatCompletionResponse"), exports);
25
+ __exportStar(require("./FinishReason"), exports);
26
+ __exportStar(require("./ReasoningEffort"), exports);
27
+ __exportStar(require("./Role"), exports);
28
+ __exportStar(require("./SarvamModelIds"), exports);
29
+ __exportStar(require("./StopConfiguration"), exports);
17
30
  __exportStar(require("./ErrorCode"), exports);
18
31
  __exportStar(require("./ErrorDetails"), exports);
19
32
  __exportStar(require("./ErrorMessage"), exports);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.0";
1
+ export declare const SDK_VERSION = "0.1.2";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.0";
4
+ exports.SDK_VERSION = "0.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sarvamai",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "repository": "https://github.com/sarvamai/sarvam-javascript-sdk",
6
6
  "main": "./index.js",
package/reference.md CHANGED
@@ -445,7 +445,7 @@ The output is a wave file encoded as a base64 string.
445
445
 
446
446
  ```typescript
447
447
  await client.textToSpeech.convert({
448
- inputs: ["inputs"],
448
+ text: "text",
449
449
  target_language_code: "bn-IN",
450
450
  });
451
451
  ```
@@ -481,3 +481,76 @@ await client.textToSpeech.convert({
481
481
  </dd>
482
482
  </dl>
483
483
  </details>
484
+
485
+ ## Chat
486
+
487
+ <details><summary><code>client.chat.<a href="/src/api/resources/chat/client/Client.ts">completions</a>({ ...params }) -> SarvamAI.CreateChatCompletionResponse</code></summary>
488
+ <dl>
489
+ <dd>
490
+
491
+ #### 📝 Description
492
+
493
+ <dl>
494
+ <dd>
495
+
496
+ <dl>
497
+ <dd>
498
+
499
+ Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
500
+
501
+ </dd>
502
+ </dl>
503
+ </dd>
504
+ </dl>
505
+
506
+ #### 🔌 Usage
507
+
508
+ <dl>
509
+ <dd>
510
+
511
+ <dl>
512
+ <dd>
513
+
514
+ ```typescript
515
+ await client.chat.completions({
516
+ messages: [
517
+ {
518
+ role: "assistant",
519
+ content: "content",
520
+ },
521
+ ],
522
+ model: "sarvam-m",
523
+ });
524
+ ```
525
+
526
+ </dd>
527
+ </dl>
528
+ </dd>
529
+ </dl>
530
+
531
+ #### ⚙️ Parameters
532
+
533
+ <dl>
534
+ <dd>
535
+
536
+ <dl>
537
+ <dd>
538
+
539
+ **request:** `SarvamAI.ChatCompletionsRequest`
540
+
541
+ </dd>
542
+ </dl>
543
+
544
+ <dl>
545
+ <dd>
546
+
547
+ **requestOptions:** `Chat.RequestOptions`
548
+
549
+ </dd>
550
+ </dl>
551
+ </dd>
552
+ </dl>
553
+
554
+ </dd>
555
+ </dl>
556
+ </details>
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.0";
1
+ export declare const SDK_VERSION = "0.1.2";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.0";
4
+ exports.SDK_VERSION = "0.1.2";