sarvamai 1.1.5 → 1.1.6
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/README.md +433 -3
- package/dist/cjs/BaseClient.d.ts +7 -7
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +4 -2
- package/dist/cjs/Client.js +21 -16
- package/dist/cjs/api/errors/BadRequestError.js +5 -1
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +6 -0
- package/dist/cjs/api/errors/ContentTooLargeError.js +54 -0
- package/dist/cjs/api/errors/ForbiddenError.js +5 -1
- package/dist/cjs/api/errors/InternalServerError.js +5 -1
- package/dist/cjs/api/errors/NotFoundError.d.ts +6 -0
- package/dist/cjs/api/errors/NotFoundError.js +54 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.js +5 -1
- package/dist/cjs/api/errors/TooManyRequestsError.js +5 -1
- package/dist/cjs/api/errors/UnprocessableEntityError.js +5 -1
- package/dist/cjs/api/errors/index.d.ts +2 -0
- package/dist/cjs/api/errors/index.js +2 -0
- package/dist/cjs/api/resources/chat/client/requests/ChatCompletionsRequest.d.ts +1 -1
- package/dist/cjs/api/resources/chat/exports.d.ts +2 -0
- package/dist/cjs/api/resources/chat/exports.js +21 -0
- package/dist/cjs/api/resources/documentIntelligence/exports.d.ts +2 -0
- package/dist/cjs/api/resources/documentIntelligence/exports.js +21 -0
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/pronunciationDictionary/client/Client.d.ts +123 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/Client.js +425 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/index.js +17 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/CreatePronunciationDictionaryRequest.d.ts +10 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/PronunciationDictionaryDeleteRequest.d.ts +10 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.d.ts +13 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pronunciationDictionary/exports.d.ts +2 -0
- package/dist/cjs/api/resources/pronunciationDictionary/exports.js +21 -0
- package/dist/cjs/api/resources/pronunciationDictionary/index.d.ts +1 -0
- package/dist/cjs/api/resources/pronunciationDictionary/index.js +17 -0
- package/dist/cjs/api/resources/speechToText/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speechToText/client/Client.js +16 -53
- package/dist/cjs/api/resources/speechToText/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToText/exports.js +21 -0
- package/dist/cjs/api/resources/speechToTextJob/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/speechToTextJob/client/SpeechToTextJobInstance.d.ts +4 -4
- package/dist/cjs/api/resources/speechToTextJob/client/SpeechToTextJobInstance.js +1 -1
- package/dist/cjs/api/resources/speechToTextJob/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextJob/exports.js +21 -0
- package/dist/cjs/api/resources/speechToTextStreaming/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextStreaming/exports.js +21 -0
- package/dist/cjs/api/resources/speechToTextTranslateJob/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/speechToTextTranslateJob/client/SpeechToTextTranslateJobInstance.d.ts +4 -4
- package/dist/cjs/api/resources/speechToTextTranslateJob/client/SpeechToTextTranslateJobInstance.js +1 -1
- package/dist/cjs/api/resources/speechToTextTranslateJob/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextTranslateJob/exports.js +21 -0
- package/dist/cjs/api/resources/speechToTextTranslateStreaming/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextTranslateStreaming/exports.js +21 -0
- package/dist/cjs/api/resources/text/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/text/client/Client.js +4 -60
- package/dist/cjs/api/resources/text/exports.d.ts +2 -0
- package/dist/cjs/api/resources/text/exports.js +21 -0
- package/dist/cjs/api/resources/textToSpeech/client/Client.d.ts +15 -2
- package/dist/cjs/api/resources/textToSpeech/client/Client.js +62 -19
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +12 -0
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.d.ts +79 -0
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.js +3 -0
- package/dist/cjs/api/resources/textToSpeech/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/textToSpeech/exports.d.ts +2 -0
- package/dist/cjs/api/resources/textToSpeech/exports.js +21 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/client/Socket.d.ts +2 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/client/Socket.js +1 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/exports.d.ts +2 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/exports.js +21 -0
- package/dist/cjs/api/types/AudioOutput.d.ts +1 -1
- package/dist/cjs/api/types/BulkJobCallback.d.ts +1 -1
- package/dist/cjs/api/types/{BulkJobInitResponseV1.d.ts → BulkJobInitResponse.d.ts} +1 -1
- package/dist/cjs/api/types/BulkJobInitResponse.js +3 -0
- package/dist/cjs/api/types/ChatCompletionRequestAssistantMessage.d.ts +2 -2
- package/dist/cjs/api/types/ChatCompletionResponseMessage.d.ts +4 -4
- package/dist/cjs/api/types/Choice.d.ts +1 -1
- package/dist/cjs/api/types/CompletionUsage.d.ts +2 -2
- package/dist/cjs/api/types/ConfigMessage.d.ts +1 -1
- package/dist/cjs/api/types/ConfigureConnection.d.ts +21 -11
- package/dist/cjs/api/types/CreateChatCompletionResponse.d.ts +3 -3
- package/dist/cjs/api/types/DocDigitizationDownloadFilesResponse.d.ts +2 -2
- package/dist/cjs/api/types/DocDigitizationErrorDetails.d.ts +1 -1
- package/dist/cjs/api/types/DocDigitizationJobDetail.d.ts +7 -7
- package/dist/cjs/api/types/DocDigitizationJobParameters.d.ts +2 -2
- package/dist/cjs/api/types/DocDigitizationJobStatusResponse.d.ts +5 -5
- package/dist/cjs/api/types/DocDigitizationWebhookCallback.d.ts +1 -1
- package/dist/cjs/api/types/ErrorCode.d.ts +1 -1
- package/dist/cjs/api/types/ErrorCode.js +1 -1
- package/dist/cjs/api/types/ErrorCode2.d.ts +11 -0
- package/dist/cjs/api/types/ErrorCode2.js +14 -0
- package/dist/cjs/api/types/ErrorDetails.d.ts +1 -2
- package/dist/cjs/api/types/ErrorDetails2.d.ts +9 -0
- package/dist/cjs/api/types/ErrorDetails2.js +3 -0
- package/dist/cjs/api/types/ErrorMessage2.d.ts +5 -0
- package/dist/cjs/api/types/ErrorMessage2.js +3 -0
- package/dist/cjs/api/types/ErrorResponse.d.ts +3 -3
- package/dist/cjs/api/types/EventResponse.d.ts +2 -2
- package/dist/cjs/api/types/EventsData.d.ts +4 -4
- package/dist/cjs/api/types/FileSignedUrlDetails.d.ts +1 -1
- package/dist/cjs/api/types/FunctionDefinition.d.ts +2 -2
- package/dist/cjs/api/types/{JobStatusV1Response.d.ts → JobStatusResponse.d.ts} +6 -6
- package/dist/cjs/api/types/JobStatusResponse.js +3 -0
- package/dist/cjs/api/types/LanguageIdentificationResponse.d.ts +3 -3
- package/dist/cjs/api/types/PronunciationDictionaryData.d.ts +7 -0
- package/dist/cjs/api/types/PronunciationDictionaryData.js +3 -0
- package/dist/cjs/api/types/PronunciationDictionaryDeleteResponse.d.ts +9 -0
- package/dist/cjs/api/types/PronunciationDictionaryDeleteResponse.js +3 -0
- package/dist/cjs/api/types/PronunciationDictionaryGetResponse.d.ts +9 -0
- package/dist/cjs/api/types/PronunciationDictionaryGetResponse.js +3 -0
- package/dist/cjs/api/types/PronunciationDictionaryResponse.d.ts +7 -0
- package/dist/cjs/api/types/PronunciationDictionaryResponse.js +3 -0
- package/dist/cjs/api/types/PronunciationDictionaryUpdateResponse.d.ts +9 -0
- package/dist/cjs/api/types/PronunciationDictionaryUpdateResponse.js +3 -0
- package/dist/cjs/api/types/SarvamModelIds.d.ts +3 -3
- package/dist/cjs/api/types/SarvamModelIds.js +3 -3
- package/dist/cjs/api/types/SpeechStreamBitrate.d.ts +8 -0
- package/dist/cjs/api/types/SpeechStreamBitrate.js +11 -0
- package/dist/cjs/api/types/SpeechStreamCodec.d.ts +11 -0
- package/dist/cjs/api/types/SpeechStreamCodec.js +14 -0
- package/dist/cjs/api/types/SpeechToTextJobParameters.d.ts +6 -6
- package/dist/cjs/api/types/SpeechToTextResponse.d.ts +5 -5
- package/dist/cjs/api/types/SpeechToTextTranscriptionData.d.ts +4 -4
- package/dist/cjs/api/types/SpeechToTextTranslateJobParameters.d.ts +4 -4
- package/dist/cjs/api/types/SpeechToTextTranslateResponse.d.ts +4 -4
- package/dist/cjs/api/types/SpeechToTextTranslateTranscriptionData.d.ts +2 -2
- package/dist/cjs/api/types/TaskDetail.d.ts +8 -0
- package/dist/cjs/api/types/TaskDetail.js +3 -0
- package/dist/cjs/api/types/TextToSpeechResponse.d.ts +1 -1
- package/dist/cjs/api/types/TranslationResponse.d.ts +1 -1
- package/dist/cjs/api/types/TransliterationResponse.d.ts +1 -1
- package/dist/cjs/api/types/index.d.ts +13 -3
- package/dist/cjs/api/types/index.js +13 -3
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -8
- package/dist/cjs/auth/HeaderAuthProvider.js +19 -9
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -2
- package/dist/cjs/core/fetcher/Fetcher.js +8 -2
- package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
- package/dist/cjs/core/fetcher/makeRequest.js +30 -9
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/websocket/ws.d.ts +1 -1
- package/dist/cjs/errors/SarvamAIError.js +5 -1
- package/dist/cjs/errors/SarvamAITimeoutError.js +5 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +7 -7
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +4 -2
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/errors/BadRequestError.mjs +5 -1
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +6 -0
- package/dist/esm/api/errors/ContentTooLargeError.mjs +17 -0
- package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
- package/dist/esm/api/errors/InternalServerError.mjs +5 -1
- package/dist/esm/api/errors/NotFoundError.d.mts +6 -0
- package/dist/esm/api/errors/NotFoundError.mjs +17 -0
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +5 -1
- package/dist/esm/api/errors/TooManyRequestsError.mjs +5 -1
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +5 -1
- package/dist/esm/api/errors/index.d.mts +2 -0
- package/dist/esm/api/errors/index.mjs +2 -0
- package/dist/esm/api/resources/chat/client/requests/ChatCompletionsRequest.d.mts +1 -1
- package/dist/esm/api/resources/chat/exports.d.mts +2 -0
- package/dist/esm/api/resources/chat/exports.mjs +3 -0
- package/dist/esm/api/resources/documentIntelligence/exports.d.mts +2 -0
- package/dist/esm/api/resources/documentIntelligence/exports.mjs +3 -0
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/Client.d.mts +123 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/Client.mjs +388 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/index.mjs +1 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/CreatePronunciationDictionaryRequest.d.mts +10 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/PronunciationDictionaryDeleteRequest.d.mts +10 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.d.mts +13 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pronunciationDictionary/exports.d.mts +2 -0
- package/dist/esm/api/resources/pronunciationDictionary/exports.mjs +3 -0
- package/dist/esm/api/resources/pronunciationDictionary/index.d.mts +1 -0
- package/dist/esm/api/resources/pronunciationDictionary/index.mjs +1 -0
- package/dist/esm/api/resources/speechToText/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speechToText/client/Client.mjs +16 -53
- package/dist/esm/api/resources/speechToText/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToText/exports.mjs +3 -0
- package/dist/esm/api/resources/speechToTextJob/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/speechToTextJob/client/SpeechToTextJobInstance.d.mts +4 -4
- package/dist/esm/api/resources/speechToTextJob/client/SpeechToTextJobInstance.mjs +1 -1
- package/dist/esm/api/resources/speechToTextJob/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextJob/exports.mjs +3 -0
- package/dist/esm/api/resources/speechToTextStreaming/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextStreaming/exports.mjs +3 -0
- package/dist/esm/api/resources/speechToTextTranslateJob/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/speechToTextTranslateJob/client/SpeechToTextTranslateJobInstance.d.mts +4 -4
- package/dist/esm/api/resources/speechToTextTranslateJob/client/SpeechToTextTranslateJobInstance.mjs +1 -1
- package/dist/esm/api/resources/speechToTextTranslateJob/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextTranslateJob/exports.mjs +3 -0
- package/dist/esm/api/resources/speechToTextTranslateStreaming/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextTranslateStreaming/exports.mjs +3 -0
- package/dist/esm/api/resources/text/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/text/client/Client.mjs +4 -60
- package/dist/esm/api/resources/text/exports.d.mts +2 -0
- package/dist/esm/api/resources/text/exports.mjs +3 -0
- package/dist/esm/api/resources/textToSpeech/client/Client.d.mts +15 -2
- package/dist/esm/api/resources/textToSpeech/client/Client.mjs +62 -19
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.mts +12 -0
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.d.mts +79 -0
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.mjs +2 -0
- package/dist/esm/api/resources/textToSpeech/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/textToSpeech/exports.d.mts +2 -0
- package/dist/esm/api/resources/textToSpeech/exports.mjs +3 -0
- package/dist/esm/api/resources/textToSpeechStreaming/client/Socket.d.mts +2 -0
- package/dist/esm/api/resources/textToSpeechStreaming/client/Socket.mjs +1 -0
- package/dist/esm/api/resources/textToSpeechStreaming/exports.d.mts +2 -0
- package/dist/esm/api/resources/textToSpeechStreaming/exports.mjs +3 -0
- package/dist/esm/api/types/AudioOutput.d.mts +1 -1
- package/dist/esm/api/types/BulkJobCallback.d.mts +1 -1
- package/dist/esm/api/types/{BulkJobInitResponseV1.d.mts → BulkJobInitResponse.d.mts} +1 -1
- package/dist/esm/api/types/BulkJobInitResponse.mjs +2 -0
- package/dist/esm/api/types/ChatCompletionRequestAssistantMessage.d.mts +2 -2
- package/dist/esm/api/types/ChatCompletionResponseMessage.d.mts +4 -4
- package/dist/esm/api/types/Choice.d.mts +1 -1
- package/dist/esm/api/types/CompletionUsage.d.mts +2 -2
- package/dist/esm/api/types/ConfigMessage.d.mts +1 -1
- package/dist/esm/api/types/ConfigureConnection.d.mts +21 -11
- package/dist/esm/api/types/CreateChatCompletionResponse.d.mts +3 -3
- package/dist/esm/api/types/DocDigitizationDownloadFilesResponse.d.mts +2 -2
- package/dist/esm/api/types/DocDigitizationErrorDetails.d.mts +1 -1
- package/dist/esm/api/types/DocDigitizationJobDetail.d.mts +7 -7
- package/dist/esm/api/types/DocDigitizationJobParameters.d.mts +2 -2
- package/dist/esm/api/types/DocDigitizationJobStatusResponse.d.mts +5 -5
- package/dist/esm/api/types/DocDigitizationWebhookCallback.d.mts +1 -1
- package/dist/esm/api/types/ErrorCode.d.mts +1 -1
- package/dist/esm/api/types/ErrorCode.mjs +1 -1
- package/dist/esm/api/types/ErrorCode2.d.mts +11 -0
- package/dist/esm/api/types/ErrorCode2.mjs +11 -0
- package/dist/esm/api/types/ErrorDetails.d.mts +1 -2
- package/dist/esm/api/types/ErrorDetails2.d.mts +9 -0
- package/dist/esm/api/types/ErrorDetails2.mjs +2 -0
- package/dist/esm/api/types/ErrorMessage2.d.mts +5 -0
- package/dist/esm/api/types/ErrorMessage2.mjs +2 -0
- package/dist/esm/api/types/ErrorResponse.d.mts +3 -3
- package/dist/esm/api/types/EventResponse.d.mts +2 -2
- package/dist/esm/api/types/EventsData.d.mts +4 -4
- package/dist/esm/api/types/FileSignedUrlDetails.d.mts +1 -1
- package/dist/esm/api/types/FunctionDefinition.d.mts +2 -2
- package/dist/esm/api/types/{JobStatusV1Response.d.mts → JobStatusResponse.d.mts} +6 -6
- package/dist/esm/api/types/JobStatusResponse.mjs +2 -0
- package/dist/esm/api/types/LanguageIdentificationResponse.d.mts +3 -3
- package/dist/esm/api/types/PronunciationDictionaryData.d.mts +7 -0
- package/dist/esm/api/types/PronunciationDictionaryData.mjs +2 -0
- package/dist/esm/api/types/PronunciationDictionaryDeleteResponse.d.mts +9 -0
- package/dist/esm/api/types/PronunciationDictionaryDeleteResponse.mjs +2 -0
- package/dist/esm/api/types/PronunciationDictionaryGetResponse.d.mts +9 -0
- package/dist/esm/api/types/PronunciationDictionaryGetResponse.mjs +2 -0
- package/dist/esm/api/types/PronunciationDictionaryResponse.d.mts +7 -0
- package/dist/esm/api/types/PronunciationDictionaryResponse.mjs +2 -0
- package/dist/esm/api/types/PronunciationDictionaryUpdateResponse.d.mts +9 -0
- package/dist/esm/api/types/PronunciationDictionaryUpdateResponse.mjs +2 -0
- package/dist/esm/api/types/SarvamModelIds.d.mts +3 -3
- package/dist/esm/api/types/SarvamModelIds.mjs +3 -3
- package/dist/esm/api/types/SpeechStreamBitrate.d.mts +8 -0
- package/dist/esm/api/types/SpeechStreamBitrate.mjs +8 -0
- package/dist/esm/api/types/SpeechStreamCodec.d.mts +11 -0
- package/dist/esm/api/types/SpeechStreamCodec.mjs +11 -0
- package/dist/esm/api/types/SpeechToTextJobParameters.d.mts +6 -6
- package/dist/esm/api/types/SpeechToTextResponse.d.mts +5 -5
- package/dist/esm/api/types/SpeechToTextTranscriptionData.d.mts +4 -4
- package/dist/esm/api/types/SpeechToTextTranslateJobParameters.d.mts +4 -4
- package/dist/esm/api/types/SpeechToTextTranslateResponse.d.mts +4 -4
- package/dist/esm/api/types/SpeechToTextTranslateTranscriptionData.d.mts +2 -2
- package/dist/esm/api/types/TaskDetail.d.mts +8 -0
- package/dist/esm/api/types/TaskDetail.mjs +2 -0
- package/dist/esm/api/types/TextToSpeechResponse.d.mts +1 -1
- package/dist/esm/api/types/TranslationResponse.d.mts +1 -1
- package/dist/esm/api/types/TransliterationResponse.d.mts +1 -1
- package/dist/esm/api/types/index.d.mts +13 -3
- package/dist/esm/api/types/index.mjs +13 -3
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -8
- package/dist/esm/auth/HeaderAuthProvider.mjs +19 -9
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +8 -2
- package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/websocket/ws.d.mts +1 -1
- package/dist/esm/errors/SarvamAIError.mjs +5 -1
- package/dist/esm/errors/SarvamAITimeoutError.mjs +5 -1
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +140 -4
- package/reference.md +403 -6
- package/dist/cjs/api/types/TaskDetailV1.d.ts +0 -8
- package/dist/esm/api/types/TaskDetailV1.d.mts +0 -8
- /package/dist/cjs/api/{types/BulkJobInitResponseV1.js → resources/pronunciationDictionary/client/requests/CreatePronunciationDictionaryRequest.js} +0 -0
- /package/dist/cjs/api/{types/JobStatusV1Response.js → resources/pronunciationDictionary/client/requests/PronunciationDictionaryDeleteRequest.js} +0 -0
- /package/dist/cjs/api/{types/TaskDetailV1.js → resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.js} +0 -0
- /package/dist/esm/api/{types/BulkJobInitResponseV1.mjs → resources/pronunciationDictionary/client/requests/CreatePronunciationDictionaryRequest.mjs} +0 -0
- /package/dist/esm/api/{types/JobStatusV1Response.mjs → resources/pronunciationDictionary/client/requests/PronunciationDictionaryDeleteRequest.mjs} +0 -0
- /package/dist/esm/api/{types/TaskDetailV1.mjs → resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.mjs} +0 -0
package/README.md
CHANGED
|
@@ -5,6 +5,28 @@
|
|
|
5
5
|
|
|
6
6
|
The Sarvam TypeScript library provides convenient access to the Sarvam APIs from TypeScript.
|
|
7
7
|
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Documentation](#documentation)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Reference](#reference)
|
|
13
|
+
- [Usage](#usage)
|
|
14
|
+
- [Request and Response Types](#request-and-response-types)
|
|
15
|
+
- [Exception Handling](#exception-handling)
|
|
16
|
+
- [File Uploads](#file-uploads)
|
|
17
|
+
- [Binary Response](#binary-response)
|
|
18
|
+
- [Advanced](#advanced)
|
|
19
|
+
- [Subpackage Exports](#subpackage-exports)
|
|
20
|
+
- [Additional Headers](#additional-headers)
|
|
21
|
+
- [Additional Query String Parameters](#additional-query-string-parameters)
|
|
22
|
+
- [Retries](#retries)
|
|
23
|
+
- [Timeouts](#timeouts)
|
|
24
|
+
- [Aborting Requests](#aborting-requests)
|
|
25
|
+
- [Access Raw Response Data](#access-raw-response-data)
|
|
26
|
+
- [Logging](#logging)
|
|
27
|
+
- [Runtime Compatibility](#runtime-compatibility)
|
|
28
|
+
- [Contributing](#contributing)
|
|
29
|
+
|
|
8
30
|
## Documentation
|
|
9
31
|
|
|
10
32
|
API reference documentation is available [here](https://www.sarvam.ai/).
|
|
@@ -34,7 +56,7 @@ await client.text.translate({
|
|
|
34
56
|
});
|
|
35
57
|
```
|
|
36
58
|
|
|
37
|
-
## Request
|
|
59
|
+
## Request and Response Types
|
|
38
60
|
|
|
39
61
|
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
|
40
62
|
following namespace:
|
|
@@ -73,8 +95,8 @@ You can upload files using the client:
|
|
|
73
95
|
|
|
74
96
|
```typescript
|
|
75
97
|
import { createReadStream } from "fs";
|
|
76
|
-
import { SarvamAIClient } from "sarvamai";
|
|
77
98
|
import * as fs from "fs";
|
|
99
|
+
import { SarvamAIClient } from "sarvamai";
|
|
78
100
|
|
|
79
101
|
const client = new SarvamAIClient({ apiSubscriptionKey: "YOUR_API_SUBSCRIPTION_KEY" });
|
|
80
102
|
await client.speechToText.transcribe({
|
|
@@ -111,13 +133,421 @@ The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-D
|
|
|
111
133
|
For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
|
|
112
134
|
|
|
113
135
|
|
|
136
|
+
## Binary Response
|
|
137
|
+
|
|
138
|
+
You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
142
|
+
const stream: ReadableStream<Uint8Array> = response.stream();
|
|
143
|
+
// const arrayBuffer: ArrayBuffer = await response.arrayBuffer();
|
|
144
|
+
// const blob: Blob = response.blob();
|
|
145
|
+
// const bytes: Uint8Array = response.bytes();
|
|
146
|
+
// You can only use the response body once, so you must choose one of the above methods.
|
|
147
|
+
// If you want to check if the response body has been used, you can use the following property.
|
|
148
|
+
const bodyUsed = response.bodyUsed;
|
|
149
|
+
```
|
|
150
|
+
<details>
|
|
151
|
+
<summary>Save binary response to a file</summary>
|
|
152
|
+
|
|
153
|
+
<blockquote>
|
|
154
|
+
<details>
|
|
155
|
+
<summary>Node.js</summary>
|
|
156
|
+
|
|
157
|
+
<blockquote>
|
|
158
|
+
<details>
|
|
159
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { createWriteStream } from 'fs';
|
|
163
|
+
import { Readable } from 'stream';
|
|
164
|
+
import { pipeline } from 'stream/promises';
|
|
165
|
+
|
|
166
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
167
|
+
|
|
168
|
+
const stream = response.stream();
|
|
169
|
+
const nodeStream = Readable.fromWeb(stream);
|
|
170
|
+
const writeStream = createWriteStream('path/to/file');
|
|
171
|
+
|
|
172
|
+
await pipeline(nodeStream, writeStream);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
</blockquote>
|
|
177
|
+
|
|
178
|
+
<blockquote>
|
|
179
|
+
<details>
|
|
180
|
+
<summary>ArrayBuffer</summary>
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import { writeFile } from 'fs/promises';
|
|
184
|
+
|
|
185
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
186
|
+
|
|
187
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
188
|
+
await writeFile('path/to/file', Buffer.from(arrayBuffer));
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
</details>
|
|
192
|
+
</blockquote>
|
|
193
|
+
|
|
194
|
+
<blockquote>
|
|
195
|
+
<details>
|
|
196
|
+
<summary>Blob</summary>
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
import { writeFile } from 'fs/promises';
|
|
200
|
+
|
|
201
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
202
|
+
|
|
203
|
+
const blob = await response.blob();
|
|
204
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
205
|
+
await writeFile('output.bin', Buffer.from(arrayBuffer));
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
</blockquote>
|
|
210
|
+
|
|
211
|
+
<blockquote>
|
|
212
|
+
<details>
|
|
213
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
import { writeFile } from 'fs/promises';
|
|
217
|
+
|
|
218
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
219
|
+
|
|
220
|
+
const bytes = await response.bytes();
|
|
221
|
+
await writeFile('path/to/file', bytes);
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
</details>
|
|
225
|
+
</blockquote>
|
|
226
|
+
|
|
227
|
+
</details>
|
|
228
|
+
</blockquote>
|
|
229
|
+
|
|
230
|
+
<blockquote>
|
|
231
|
+
<details>
|
|
232
|
+
<summary>Bun</summary>
|
|
233
|
+
|
|
234
|
+
<blockquote>
|
|
235
|
+
<details>
|
|
236
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
240
|
+
|
|
241
|
+
const stream = response.stream();
|
|
242
|
+
await Bun.write('path/to/file', stream);
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
</blockquote>
|
|
247
|
+
|
|
248
|
+
<blockquote>
|
|
249
|
+
<details>
|
|
250
|
+
<summary>ArrayBuffer</summary>
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
254
|
+
|
|
255
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
256
|
+
await Bun.write('path/to/file', arrayBuffer);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
</details>
|
|
260
|
+
</blockquote>
|
|
261
|
+
|
|
262
|
+
<blockquote>
|
|
263
|
+
<details>
|
|
264
|
+
<summary>Blob</summary>
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
268
|
+
|
|
269
|
+
const blob = await response.blob();
|
|
270
|
+
await Bun.write('path/to/file', blob);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
</details>
|
|
274
|
+
</blockquote>
|
|
275
|
+
|
|
276
|
+
<blockquote>
|
|
277
|
+
<details>
|
|
278
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
282
|
+
|
|
283
|
+
const bytes = await response.bytes();
|
|
284
|
+
await Bun.write('path/to/file', bytes);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
</details>
|
|
288
|
+
</blockquote>
|
|
289
|
+
|
|
290
|
+
</details>
|
|
291
|
+
</blockquote>
|
|
292
|
+
|
|
293
|
+
<blockquote>
|
|
294
|
+
<details>
|
|
295
|
+
<summary>Deno</summary>
|
|
296
|
+
|
|
297
|
+
<blockquote>
|
|
298
|
+
<details>
|
|
299
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
303
|
+
|
|
304
|
+
const stream = response.stream();
|
|
305
|
+
const file = await Deno.open('path/to/file', { write: true, create: true });
|
|
306
|
+
await stream.pipeTo(file.writable);
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
</details>
|
|
310
|
+
</blockquote>
|
|
311
|
+
|
|
312
|
+
<blockquote>
|
|
313
|
+
<details>
|
|
314
|
+
<summary>ArrayBuffer</summary>
|
|
315
|
+
|
|
316
|
+
```ts
|
|
317
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
318
|
+
|
|
319
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
320
|
+
await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
</details>
|
|
324
|
+
</blockquote>
|
|
325
|
+
|
|
326
|
+
<blockquote>
|
|
327
|
+
<details>
|
|
328
|
+
<summary>Blob</summary>
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
332
|
+
|
|
333
|
+
const blob = await response.blob();
|
|
334
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
335
|
+
await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
</details>
|
|
339
|
+
</blockquote>
|
|
340
|
+
|
|
341
|
+
<blockquote>
|
|
342
|
+
<details>
|
|
343
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
344
|
+
|
|
345
|
+
```ts
|
|
346
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
347
|
+
|
|
348
|
+
const bytes = await response.bytes();
|
|
349
|
+
await Deno.writeFile('path/to/file', bytes);
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
</details>
|
|
353
|
+
</blockquote>
|
|
354
|
+
|
|
355
|
+
</details>
|
|
356
|
+
</blockquote>
|
|
357
|
+
|
|
358
|
+
<blockquote>
|
|
359
|
+
<details>
|
|
360
|
+
<summary>Browser</summary>
|
|
361
|
+
|
|
362
|
+
<blockquote>
|
|
363
|
+
<details>
|
|
364
|
+
<summary>Blob (most-efficient)</summary>
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
368
|
+
|
|
369
|
+
const blob = await response.blob();
|
|
370
|
+
const url = URL.createObjectURL(blob);
|
|
371
|
+
|
|
372
|
+
// trigger download
|
|
373
|
+
const a = document.createElement('a');
|
|
374
|
+
a.href = url;
|
|
375
|
+
a.download = 'filename';
|
|
376
|
+
a.click();
|
|
377
|
+
URL.revokeObjectURL(url);
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
</details>
|
|
381
|
+
</blockquote>
|
|
382
|
+
|
|
383
|
+
<blockquote>
|
|
384
|
+
<details>
|
|
385
|
+
<summary>ReadableStream</summary>
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
389
|
+
|
|
390
|
+
const stream = response.stream();
|
|
391
|
+
const reader = stream.getReader();
|
|
392
|
+
const chunks = [];
|
|
393
|
+
|
|
394
|
+
while (true) {
|
|
395
|
+
const { done, value } = await reader.read();
|
|
396
|
+
if (done) break;
|
|
397
|
+
chunks.push(value);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const blob = new Blob(chunks);
|
|
401
|
+
const url = URL.createObjectURL(blob);
|
|
402
|
+
|
|
403
|
+
// trigger download
|
|
404
|
+
const a = document.createElement('a');
|
|
405
|
+
a.href = url;
|
|
406
|
+
a.download = 'filename';
|
|
407
|
+
a.click();
|
|
408
|
+
URL.revokeObjectURL(url);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
</details>
|
|
412
|
+
</blockquote>
|
|
413
|
+
|
|
414
|
+
<blockquote>
|
|
415
|
+
<details>
|
|
416
|
+
<summary>ArrayBuffer</summary>
|
|
417
|
+
|
|
418
|
+
```ts
|
|
419
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
420
|
+
|
|
421
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
422
|
+
const blob = new Blob([arrayBuffer]);
|
|
423
|
+
const url = URL.createObjectURL(blob);
|
|
424
|
+
|
|
425
|
+
// trigger download
|
|
426
|
+
const a = document.createElement('a');
|
|
427
|
+
a.href = url;
|
|
428
|
+
a.download = 'filename';
|
|
429
|
+
a.click();
|
|
430
|
+
URL.revokeObjectURL(url);
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
</details>
|
|
434
|
+
</blockquote>
|
|
435
|
+
|
|
436
|
+
<blockquote>
|
|
437
|
+
<details>
|
|
438
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
442
|
+
|
|
443
|
+
const bytes = await response.bytes();
|
|
444
|
+
const blob = new Blob([bytes]);
|
|
445
|
+
const url = URL.createObjectURL(blob);
|
|
446
|
+
|
|
447
|
+
// trigger download
|
|
448
|
+
const a = document.createElement('a');
|
|
449
|
+
a.href = url;
|
|
450
|
+
a.download = 'filename';
|
|
451
|
+
a.click();
|
|
452
|
+
URL.revokeObjectURL(url);
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
</details>
|
|
456
|
+
</blockquote>
|
|
457
|
+
|
|
458
|
+
</details>
|
|
459
|
+
</blockquote>
|
|
460
|
+
|
|
461
|
+
</details>
|
|
462
|
+
</blockquote>
|
|
463
|
+
|
|
464
|
+
<details>
|
|
465
|
+
<summary>Convert binary response to text</summary>
|
|
466
|
+
|
|
467
|
+
<blockquote>
|
|
468
|
+
<details>
|
|
469
|
+
<summary>ReadableStream</summary>
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
473
|
+
|
|
474
|
+
const stream = response.stream();
|
|
475
|
+
const text = await new Response(stream).text();
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
</details>
|
|
479
|
+
</blockquote>
|
|
480
|
+
|
|
481
|
+
<blockquote>
|
|
482
|
+
<details>
|
|
483
|
+
<summary>ArrayBuffer</summary>
|
|
484
|
+
|
|
485
|
+
```ts
|
|
486
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
487
|
+
|
|
488
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
489
|
+
const text = new TextDecoder().decode(arrayBuffer);
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
</details>
|
|
493
|
+
</blockquote>
|
|
494
|
+
|
|
495
|
+
<blockquote>
|
|
496
|
+
<details>
|
|
497
|
+
<summary>Blob</summary>
|
|
498
|
+
|
|
499
|
+
```ts
|
|
500
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
501
|
+
|
|
502
|
+
const blob = await response.blob();
|
|
503
|
+
const text = await blob.text();
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
</details>
|
|
507
|
+
</blockquote>
|
|
508
|
+
|
|
509
|
+
<blockquote>
|
|
510
|
+
<details>
|
|
511
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
512
|
+
|
|
513
|
+
```ts
|
|
514
|
+
const response = await client.textToSpeech.convertStream(...);
|
|
515
|
+
|
|
516
|
+
const bytes = await response.bytes();
|
|
517
|
+
const text = new TextDecoder().decode(bytes);
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
</details>
|
|
521
|
+
</blockquote>
|
|
522
|
+
|
|
523
|
+
</details>
|
|
524
|
+
|
|
114
525
|
## Advanced
|
|
115
526
|
|
|
527
|
+
### Subpackage Exports
|
|
528
|
+
|
|
529
|
+
This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
import { TextClient } from 'sarvamai/text';
|
|
533
|
+
|
|
534
|
+
const client = new TextClient({...});
|
|
535
|
+
```
|
|
536
|
+
|
|
116
537
|
### Additional Headers
|
|
117
538
|
|
|
118
539
|
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
119
540
|
|
|
120
541
|
```typescript
|
|
542
|
+
import { SarvamAIClient } from "sarvamai";
|
|
543
|
+
|
|
544
|
+
const client = new SarvamAIClient({
|
|
545
|
+
...
|
|
546
|
+
headers: {
|
|
547
|
+
'X-Custom-Header': 'custom value'
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
|
|
121
551
|
const response = await client.text.translate(..., {
|
|
122
552
|
headers: {
|
|
123
553
|
'X-Custom-Header': 'custom value'
|
|
@@ -290,4 +720,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t
|
|
|
290
720
|
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
291
721
|
an issue first to discuss with us!
|
|
292
722
|
|
|
293
|
-
On the other hand, contributions to the README are always very welcome!
|
|
723
|
+
On the other hand, contributions to the README are always very welcome!
|
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
|
|
1
2
|
import * as core from "./core/index.js";
|
|
2
3
|
import type * as environments from "./environments.js";
|
|
3
|
-
export
|
|
4
|
+
export type BaseClientOptions = {
|
|
4
5
|
environment?: core.Supplier<environments.SarvamAIEnvironment | environments.SarvamAIEnvironmentUrls>;
|
|
5
6
|
/** Specify a custom URL to connect the client to. */
|
|
6
7
|
baseUrl?: core.Supplier<string>;
|
|
7
|
-
apiSubscriptionKey?: core.Supplier<string>;
|
|
8
8
|
/** Additional headers to include in requests. */
|
|
9
9
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
10
|
/** The default maximum time to wait for a response in seconds. */
|
|
@@ -15,7 +15,7 @@ export interface BaseClientOptions {
|
|
|
15
15
|
fetch?: typeof fetch;
|
|
16
16
|
/** Configure logging for the client. */
|
|
17
17
|
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
18
|
-
}
|
|
18
|
+
} & HeaderAuthProvider.AuthOptions;
|
|
19
19
|
export interface BaseRequestOptions {
|
|
20
20
|
/** The maximum time to wait for a response in seconds. */
|
|
21
21
|
timeoutInSeconds?: number;
|
|
@@ -28,12 +28,12 @@ export interface BaseRequestOptions {
|
|
|
28
28
|
/** Additional headers to include in the request. */
|
|
29
29
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
30
30
|
}
|
|
31
|
-
export type NormalizedClientOptions<T extends BaseClientOptions> = T & {
|
|
31
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
32
32
|
logging: core.logging.Logger;
|
|
33
33
|
authProvider?: core.AuthProvider;
|
|
34
34
|
};
|
|
35
|
-
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
35
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
36
36
|
authProvider: core.AuthProvider;
|
|
37
37
|
};
|
|
38
|
-
export declare function normalizeClientOptions<T extends BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
39
|
-
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
38
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
39
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
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.6",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.6",
|
|
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);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChatClient } from "./api/resources/chat/client/Client.js";
|
|
2
2
|
import { DocumentIntelligenceClient } from "./api/resources/documentIntelligence/client/Client.js";
|
|
3
|
+
import { PronunciationDictionaryClient } from "./api/resources/pronunciationDictionary/client/Client.js";
|
|
3
4
|
import { SpeechToTextClient } from "./api/resources/speechToText/client/Client.js";
|
|
4
5
|
import { SpeechToTextJobClient } from "./api/resources/speechToTextJob/client/Client.js";
|
|
5
6
|
import { SpeechToTextStreamingClient } from "./api/resources/speechToTextStreaming/client/Client.js";
|
|
@@ -11,8 +12,7 @@ import { TextToSpeechStreamingClient } from "./api/resources/textToSpeechStreami
|
|
|
11
12
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
12
13
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
13
14
|
export declare namespace SarvamAIClient {
|
|
14
|
-
|
|
15
|
-
}
|
|
15
|
+
type Options = BaseClientOptions;
|
|
16
16
|
interface RequestOptions extends BaseRequestOptions {
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -21,6 +21,7 @@ export declare class SarvamAIClient {
|
|
|
21
21
|
protected _text: TextClient | undefined;
|
|
22
22
|
protected _speechToText: SpeechToTextClient | undefined;
|
|
23
23
|
protected _textToSpeech: TextToSpeechClient | undefined;
|
|
24
|
+
protected _pronunciationDictionary: PronunciationDictionaryClient | undefined;
|
|
24
25
|
protected _chat: ChatClient | undefined;
|
|
25
26
|
protected _speechToTextJob: SpeechToTextJobClient | undefined;
|
|
26
27
|
protected _speechToTextTranslateJob: SpeechToTextTranslateJobClient | undefined;
|
|
@@ -32,6 +33,7 @@ export declare class SarvamAIClient {
|
|
|
32
33
|
get text(): TextClient;
|
|
33
34
|
get speechToText(): SpeechToTextClient;
|
|
34
35
|
get textToSpeech(): TextToSpeechClient;
|
|
36
|
+
get pronunciationDictionary(): PronunciationDictionaryClient;
|
|
35
37
|
get chat(): ChatClient;
|
|
36
38
|
get speechToTextJob(): SpeechToTextJobClient;
|
|
37
39
|
get speechToTextTranslateJob(): SpeechToTextTranslateJobClient;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -4,14 +4,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.SarvamAIClient = void 0;
|
|
5
5
|
const Client_js_1 = require("./api/resources/chat/client/Client.js");
|
|
6
6
|
const Client_js_2 = require("./api/resources/documentIntelligence/client/Client.js");
|
|
7
|
-
const Client_js_3 = require("./api/resources/
|
|
8
|
-
const Client_js_4 = require("./api/resources/
|
|
9
|
-
const Client_js_5 = require("./api/resources/
|
|
10
|
-
const Client_js_6 = require("./api/resources/
|
|
11
|
-
const Client_js_7 = require("./api/resources/
|
|
12
|
-
const Client_js_8 = require("./api/resources/
|
|
13
|
-
const Client_js_9 = require("./api/resources/
|
|
14
|
-
const Client_js_10 = require("./api/resources/
|
|
7
|
+
const Client_js_3 = require("./api/resources/pronunciationDictionary/client/Client.js");
|
|
8
|
+
const Client_js_4 = require("./api/resources/speechToText/client/Client.js");
|
|
9
|
+
const Client_js_5 = require("./api/resources/speechToTextJob/client/Client.js");
|
|
10
|
+
const Client_js_6 = require("./api/resources/speechToTextStreaming/client/Client.js");
|
|
11
|
+
const Client_js_7 = require("./api/resources/speechToTextTranslateJob/client/Client.js");
|
|
12
|
+
const Client_js_8 = require("./api/resources/speechToTextTranslateStreaming/client/Client.js");
|
|
13
|
+
const Client_js_9 = require("./api/resources/text/client/Client.js");
|
|
14
|
+
const Client_js_10 = require("./api/resources/textToSpeech/client/Client.js");
|
|
15
|
+
const Client_js_11 = require("./api/resources/textToSpeechStreaming/client/Client.js");
|
|
15
16
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
16
17
|
class SarvamAIClient {
|
|
17
18
|
constructor(options = {}) {
|
|
@@ -19,15 +20,19 @@ class SarvamAIClient {
|
|
|
19
20
|
}
|
|
20
21
|
get text() {
|
|
21
22
|
var _a;
|
|
22
|
-
return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new
|
|
23
|
+
return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new Client_js_9.TextClient(this._options)));
|
|
23
24
|
}
|
|
24
25
|
get speechToText() {
|
|
25
26
|
var _a;
|
|
26
|
-
return ((_a = this._speechToText) !== null && _a !== void 0 ? _a : (this._speechToText = new
|
|
27
|
+
return ((_a = this._speechToText) !== null && _a !== void 0 ? _a : (this._speechToText = new Client_js_4.SpeechToTextClient(this._options)));
|
|
27
28
|
}
|
|
28
29
|
get textToSpeech() {
|
|
29
30
|
var _a;
|
|
30
|
-
return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new
|
|
31
|
+
return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new Client_js_10.TextToSpeechClient(this._options)));
|
|
32
|
+
}
|
|
33
|
+
get pronunciationDictionary() {
|
|
34
|
+
var _a;
|
|
35
|
+
return ((_a = this._pronunciationDictionary) !== null && _a !== void 0 ? _a : (this._pronunciationDictionary = new Client_js_3.PronunciationDictionaryClient(this._options)));
|
|
31
36
|
}
|
|
32
37
|
get chat() {
|
|
33
38
|
var _a;
|
|
@@ -35,11 +40,11 @@ class SarvamAIClient {
|
|
|
35
40
|
}
|
|
36
41
|
get speechToTextJob() {
|
|
37
42
|
var _a;
|
|
38
|
-
return ((_a = this._speechToTextJob) !== null && _a !== void 0 ? _a : (this._speechToTextJob = new
|
|
43
|
+
return ((_a = this._speechToTextJob) !== null && _a !== void 0 ? _a : (this._speechToTextJob = new Client_js_5.SpeechToTextJobClient(this._options)));
|
|
39
44
|
}
|
|
40
45
|
get speechToTextTranslateJob() {
|
|
41
46
|
var _a;
|
|
42
|
-
return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new
|
|
47
|
+
return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new Client_js_7.SpeechToTextTranslateJobClient(this._options)));
|
|
43
48
|
}
|
|
44
49
|
get documentIntelligence() {
|
|
45
50
|
var _a;
|
|
@@ -47,15 +52,15 @@ class SarvamAIClient {
|
|
|
47
52
|
}
|
|
48
53
|
get speechToTextStreaming() {
|
|
49
54
|
var _a;
|
|
50
|
-
return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new
|
|
55
|
+
return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new Client_js_6.SpeechToTextStreamingClient(this._options)));
|
|
51
56
|
}
|
|
52
57
|
get speechToTextTranslateStreaming() {
|
|
53
58
|
var _a;
|
|
54
|
-
return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new
|
|
59
|
+
return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new Client_js_8.SpeechToTextTranslateStreamingClient(this._options)));
|
|
55
60
|
}
|
|
56
61
|
get textToSpeechStreaming() {
|
|
57
62
|
var _a;
|
|
58
|
-
return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new
|
|
63
|
+
return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new Client_js_11.TextToSpeechStreamingClient(this._options)));
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
66
|
exports.SarvamAIClient = SarvamAIClient;
|
|
@@ -44,7 +44,11 @@ class BadRequestError extends errors.SarvamAIError {
|
|
|
44
44
|
body: body,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
exports.BadRequestError = BadRequestError;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
2
|
+
import * as errors from "../../errors/index.js";
|
|
3
|
+
import type * as SarvamAI from "../index.js";
|
|
4
|
+
export declare class ContentTooLargeError extends errors.SarvamAIError {
|
|
5
|
+
constructor(body: SarvamAI.ErrorMessage, rawResponse?: core.RawResponse);
|
|
6
|
+
}
|