sarvamai 0.0.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.
- package/Client.d.ts +45 -0
- package/Client.js +37 -0
- package/README.md +159 -0
- package/api/errors/BadRequestError.d.ts +7 -0
- package/api/errors/BadRequestError.js +51 -0
- package/api/errors/ForbiddenError.d.ts +8 -0
- package/api/errors/ForbiddenError.js +51 -0
- package/api/errors/InternalServerError.d.ts +7 -0
- package/api/errors/InternalServerError.js +51 -0
- package/api/errors/ServiceUnavailableError.d.ts +8 -0
- package/api/errors/ServiceUnavailableError.js +51 -0
- package/api/errors/TooManyRequestsError.d.ts +8 -0
- package/api/errors/TooManyRequestsError.js +51 -0
- package/api/errors/UnprocessableEntityError.d.ts +7 -0
- package/api/errors/UnprocessableEntityError.js +51 -0
- package/api/errors/index.d.ts +6 -0
- package/api/errors/index.js +22 -0
- package/api/index.d.ts +3 -0
- package/api/index.js +19 -0
- package/api/resources/analytics/client/Client.d.ts +73 -0
- package/api/resources/analytics/client/Client.js +223 -0
- package/api/resources/analytics/client/index.d.ts +1 -0
- package/api/resources/analytics/client/index.js +17 -0
- package/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +24 -0
- package/api/resources/analytics/client/requests/CallAnalyticsRequest.js +5 -0
- package/api/resources/analytics/client/requests/index.d.ts +1 -0
- package/api/resources/analytics/client/requests/index.js +2 -0
- package/api/resources/analytics/index.d.ts +1 -0
- package/api/resources/analytics/index.js +17 -0
- package/api/resources/index.d.ts +10 -0
- package/api/resources/index.js +49 -0
- package/api/resources/pdf/client/Client.d.ts +63 -0
- package/api/resources/pdf/client/Client.js +215 -0
- package/api/resources/pdf/client/index.d.ts +1 -0
- package/api/resources/pdf/client/index.js +17 -0
- package/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +21 -0
- package/api/resources/pdf/client/requests/ParsePdfRequest.js +5 -0
- package/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +32 -0
- package/api/resources/pdf/client/requests/TranslatePdfRequest.js +5 -0
- package/api/resources/pdf/client/requests/index.d.ts +2 -0
- package/api/resources/pdf/client/requests/index.js +2 -0
- package/api/resources/pdf/index.d.ts +1 -0
- package/api/resources/pdf/index.js +17 -0
- package/api/resources/speechToText/client/Client.d.ts +93 -0
- package/api/resources/speechToText/client/Client.js +263 -0
- package/api/resources/speechToText/client/index.d.ts +1 -0
- package/api/resources/speechToText/client/index.js +17 -0
- package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +33 -0
- package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.js +5 -0
- package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +22 -0
- package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.js +5 -0
- package/api/resources/speechToText/client/requests/index.d.ts +2 -0
- package/api/resources/speechToText/client/requests/index.js +2 -0
- package/api/resources/speechToText/index.d.ts +1 -0
- package/api/resources/speechToText/index.js +17 -0
- package/api/resources/text/client/Client.d.ts +127 -0
- package/api/resources/text/client/Client.js +314 -0
- package/api/resources/text/client/index.d.ts +1 -0
- package/api/resources/text/client/index.js +17 -0
- package/api/resources/text/client/requests/LanguageIdentificationRequest.d.ts +13 -0
- package/api/resources/text/client/requests/LanguageIdentificationRequest.js +5 -0
- package/api/resources/text/client/requests/TranslationRequest.d.ts +77 -0
- package/api/resources/text/client/requests/TranslationRequest.js +5 -0
- package/api/resources/text/client/requests/TransliterationRequest.d.ts +68 -0
- package/api/resources/text/client/requests/TransliterationRequest.js +5 -0
- package/api/resources/text/client/requests/index.d.ts +3 -0
- package/api/resources/text/client/requests/index.js +2 -0
- package/api/resources/text/index.d.ts +1 -0
- package/api/resources/text/index.js +17 -0
- package/api/resources/textToSpeech/client/Client.d.ts +51 -0
- package/api/resources/textToSpeech/client/Client.js +134 -0
- package/api/resources/textToSpeech/client/index.d.ts +1 -0
- package/api/resources/textToSpeech/client/index.js +17 -0
- package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +35 -0
- package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.js +5 -0
- package/api/resources/textToSpeech/client/requests/index.d.ts +1 -0
- package/api/resources/textToSpeech/client/requests/index.js +2 -0
- package/api/resources/textToSpeech/index.d.ts +1 -0
- package/api/resources/textToSpeech/index.js +17 -0
- package/api/types/CallAnalyticsJobParameters.d.ts +21 -0
- package/api/types/CallAnalyticsJobParameters.js +5 -0
- package/api/types/CallAnalyticsJobRequest.d.ts +10 -0
- package/api/types/CallAnalyticsJobRequest.js +5 -0
- package/api/types/CallAnalyticsResponse.d.ts +19 -0
- package/api/types/CallAnalyticsResponse.js +5 -0
- package/api/types/DiarizedEntry.d.ts +13 -0
- package/api/types/DiarizedEntry.js +5 -0
- package/api/types/DiarizedTranscript.d.ts +8 -0
- package/api/types/DiarizedTranscript.js +5 -0
- package/api/types/ErrorCode.d.ts +16 -0
- package/api/types/ErrorCode.js +18 -0
- package/api/types/ErrorDetails.d.ts +10 -0
- package/api/types/ErrorDetails.js +5 -0
- package/api/types/ErrorMessage.d.ts +8 -0
- package/api/types/ErrorMessage.js +5 -0
- package/api/types/Language.d.ts +17 -0
- package/api/types/Language.js +19 -0
- package/api/types/LanguageIdentificationResponse.d.ts +39 -0
- package/api/types/LanguageIdentificationResponse.js +5 -0
- package/api/types/NumeralsFormat.d.ts +8 -0
- package/api/types/NumeralsFormat.js +10 -0
- package/api/types/ParsedPageResponse.d.ts +7 -0
- package/api/types/ParsedPageResponse.js +5 -0
- package/api/types/PromptCaching.d.ts +8 -0
- package/api/types/PromptCaching.js +10 -0
- package/api/types/QnaResponse.d.ts +15 -0
- package/api/types/QnaResponse.js +5 -0
- package/api/types/Question.d.ts +23 -0
- package/api/types/Question.js +5 -0
- package/api/types/QuestionType.d.ts +11 -0
- package/api/types/QuestionType.js +13 -0
- package/api/types/SarvamMode.d.ts +8 -0
- package/api/types/SarvamMode.js +10 -0
- package/api/types/SpeechSampleRate.d.ts +4 -0
- package/api/types/SpeechSampleRate.js +5 -0
- package/api/types/SpeechToTextLanguage.d.ts +18 -0
- package/api/types/SpeechToTextLanguage.js +20 -0
- package/api/types/SpeechToTextModel.d.ts +9 -0
- package/api/types/SpeechToTextModel.js +11 -0
- package/api/types/SpeechToTextResponse.d.ts +15 -0
- package/api/types/SpeechToTextResponse.js +5 -0
- package/api/types/SpeechToTextTranslateLanguage.d.ts +17 -0
- package/api/types/SpeechToTextTranslateLanguage.js +19 -0
- package/api/types/SpeechToTextTranslateModel.d.ts +10 -0
- package/api/types/SpeechToTextTranslateModel.js +12 -0
- package/api/types/SpeechToTextTranslateResponse.d.ts +13 -0
- package/api/types/SpeechToTextTranslateResponse.js +5 -0
- package/api/types/SpokenFormNumeralsFormat.d.ts +8 -0
- package/api/types/SpokenFormNumeralsFormat.js +10 -0
- package/api/types/TextAnalyticsRequest.d.ts +9 -0
- package/api/types/TextAnalyticsRequest.js +5 -0
- package/api/types/TextAnalyticsResponse.d.ts +9 -0
- package/api/types/TextAnalyticsResponse.js +5 -0
- package/api/types/TextToSpeechLanguage.d.ts +17 -0
- package/api/types/TextToSpeechLanguage.js +19 -0
- package/api/types/TextToSpeechModel.d.ts +4 -0
- package/api/types/TextToSpeechModel.js +5 -0
- package/api/types/TextToSpeechResponse.d.ts +8 -0
- package/api/types/TextToSpeechResponse.js +5 -0
- package/api/types/TextToSpeechSpeaker.d.ts +18 -0
- package/api/types/TextToSpeechSpeaker.js +20 -0
- package/api/types/TimestampsModel.d.ts +11 -0
- package/api/types/TimestampsModel.js +5 -0
- package/api/types/TranslateMode.d.ts +10 -0
- package/api/types/TranslateMode.js +12 -0
- package/api/types/TranslateModel.d.ts +4 -0
- package/api/types/TranslateModel.js +5 -0
- package/api/types/TranslatePostprocessing.d.ts +9 -0
- package/api/types/TranslatePostprocessing.js +11 -0
- package/api/types/TranslateSourceLanguage.d.ts +18 -0
- package/api/types/TranslateSourceLanguage.js +20 -0
- package/api/types/TranslateSpeakerGender.d.ts +8 -0
- package/api/types/TranslateSpeakerGender.js +10 -0
- package/api/types/TranslateTargetLanguage.d.ts +17 -0
- package/api/types/TranslateTargetLanguage.js +19 -0
- package/api/types/TranslatedPage.d.ts +7 -0
- package/api/types/TranslatedPage.js +5 -0
- package/api/types/TranslationResponse.d.ts +10 -0
- package/api/types/TranslationResponse.js +5 -0
- package/api/types/TranslatiterateTargetLanguage.d.ts +17 -0
- package/api/types/TranslatiterateTargetLanguage.js +19 -0
- package/api/types/TransliterateSourceLanguage.d.ts +18 -0
- package/api/types/TransliterateSourceLanguage.js +20 -0
- package/api/types/TransliterationResponse.d.ts +10 -0
- package/api/types/TransliterationResponse.js +5 -0
- package/api/types/index.d.ts +43 -0
- package/api/types/index.js +59 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/APIResponse.js +2 -0
- package/core/fetcher/Fetcher.d.ts +39 -0
- package/core/fetcher/Fetcher.js +100 -0
- package/core/fetcher/Supplier.d.ts +4 -0
- package/core/fetcher/Supplier.js +22 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +12 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +68 -0
- package/core/fetcher/getHeader.d.ts +1 -0
- package/core/fetcher/getHeader.js +11 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +54 -0
- package/core/fetcher/index.d.ts +5 -0
- package/core/fetcher/index.js +9 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +40 -0
- package/core/fetcher/signals.d.ts +11 -0
- package/core/fetcher/signals.js +36 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/core/form-data-utils/FormDataWrapper.d.ts +60 -0
- package/core/form-data-utils/FormDataWrapper.js +188 -0
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +2 -0
- package/core/form-data-utils/index.js +20 -0
- package/core/index.d.ts +3 -0
- package/core/index.js +19 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +9 -0
- package/core/runtime/runtime.js +103 -0
- package/dist/Client.d.ts +45 -0
- package/dist/Client.js +37 -0
- package/dist/api/errors/BadRequestError.d.ts +7 -0
- package/dist/api/errors/BadRequestError.js +51 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +51 -0
- package/dist/api/errors/InternalServerError.d.ts +7 -0
- package/dist/api/errors/InternalServerError.js +51 -0
- package/dist/api/errors/ServiceUnavailableError.d.ts +8 -0
- package/dist/api/errors/ServiceUnavailableError.js +51 -0
- package/dist/api/errors/TooManyRequestsError.d.ts +8 -0
- package/dist/api/errors/TooManyRequestsError.js +51 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +7 -0
- package/dist/api/errors/UnprocessableEntityError.js +51 -0
- package/dist/api/errors/index.d.ts +6 -0
- package/dist/api/errors/index.js +22 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/analytics/client/Client.d.ts +73 -0
- package/dist/api/resources/analytics/client/Client.js +223 -0
- package/dist/api/resources/analytics/client/index.d.ts +1 -0
- package/dist/api/resources/analytics/client/index.js +17 -0
- package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +24 -0
- package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.js +5 -0
- package/dist/api/resources/analytics/client/requests/index.d.ts +1 -0
- package/dist/api/resources/analytics/client/requests/index.js +2 -0
- package/dist/api/resources/analytics/index.d.ts +1 -0
- package/dist/api/resources/analytics/index.js +17 -0
- package/dist/api/resources/index.d.ts +10 -0
- package/dist/api/resources/index.js +49 -0
- package/dist/api/resources/pdf/client/Client.d.ts +63 -0
- package/dist/api/resources/pdf/client/Client.js +215 -0
- package/dist/api/resources/pdf/client/index.d.ts +1 -0
- package/dist/api/resources/pdf/client/index.js +17 -0
- package/dist/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +21 -0
- package/dist/api/resources/pdf/client/requests/ParsePdfRequest.js +5 -0
- package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +32 -0
- package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.js +5 -0
- package/dist/api/resources/pdf/client/requests/index.d.ts +2 -0
- package/dist/api/resources/pdf/client/requests/index.js +2 -0
- package/dist/api/resources/pdf/index.d.ts +1 -0
- package/dist/api/resources/pdf/index.js +17 -0
- package/dist/api/resources/speechToText/client/Client.d.ts +93 -0
- package/dist/api/resources/speechToText/client/Client.js +263 -0
- package/dist/api/resources/speechToText/client/index.d.ts +1 -0
- package/dist/api/resources/speechToText/client/index.js +17 -0
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +33 -0
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.js +5 -0
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +22 -0
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.js +5 -0
- package/dist/api/resources/speechToText/client/requests/index.d.ts +2 -0
- package/dist/api/resources/speechToText/client/requests/index.js +2 -0
- package/dist/api/resources/speechToText/index.d.ts +1 -0
- package/dist/api/resources/speechToText/index.js +17 -0
- package/dist/api/resources/text/client/Client.d.ts +127 -0
- package/dist/api/resources/text/client/Client.js +314 -0
- package/dist/api/resources/text/client/index.d.ts +1 -0
- package/dist/api/resources/text/client/index.js +17 -0
- package/dist/api/resources/text/client/requests/LanguageIdentificationRequest.d.ts +13 -0
- package/dist/api/resources/text/client/requests/LanguageIdentificationRequest.js +5 -0
- package/dist/api/resources/text/client/requests/TranslationRequest.d.ts +77 -0
- package/dist/api/resources/text/client/requests/TranslationRequest.js +5 -0
- package/dist/api/resources/text/client/requests/TransliterationRequest.d.ts +68 -0
- package/dist/api/resources/text/client/requests/TransliterationRequest.js +5 -0
- package/dist/api/resources/text/client/requests/index.d.ts +3 -0
- package/dist/api/resources/text/client/requests/index.js +2 -0
- package/dist/api/resources/text/index.d.ts +1 -0
- package/dist/api/resources/text/index.js +17 -0
- package/dist/api/resources/textToSpeech/client/Client.d.ts +51 -0
- package/dist/api/resources/textToSpeech/client/Client.js +134 -0
- package/dist/api/resources/textToSpeech/client/index.d.ts +1 -0
- package/dist/api/resources/textToSpeech/client/index.js +17 -0
- package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +35 -0
- package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.js +5 -0
- package/dist/api/resources/textToSpeech/client/requests/index.d.ts +1 -0
- package/dist/api/resources/textToSpeech/client/requests/index.js +2 -0
- package/dist/api/resources/textToSpeech/index.d.ts +1 -0
- package/dist/api/resources/textToSpeech/index.js +17 -0
- package/dist/api/types/CallAnalyticsJobParameters.d.ts +21 -0
- package/dist/api/types/CallAnalyticsJobParameters.js +5 -0
- package/dist/api/types/CallAnalyticsJobRequest.d.ts +10 -0
- package/dist/api/types/CallAnalyticsJobRequest.js +5 -0
- package/dist/api/types/CallAnalyticsResponse.d.ts +19 -0
- package/dist/api/types/CallAnalyticsResponse.js +5 -0
- package/dist/api/types/DiarizedEntry.d.ts +13 -0
- package/dist/api/types/DiarizedEntry.js +5 -0
- package/dist/api/types/DiarizedTranscript.d.ts +8 -0
- package/dist/api/types/DiarizedTranscript.js +5 -0
- package/dist/api/types/ErrorCode.d.ts +16 -0
- package/dist/api/types/ErrorCode.js +18 -0
- package/dist/api/types/ErrorDetails.d.ts +10 -0
- package/dist/api/types/ErrorDetails.js +5 -0
- package/dist/api/types/ErrorMessage.d.ts +8 -0
- package/dist/api/types/ErrorMessage.js +5 -0
- package/dist/api/types/Language.d.ts +17 -0
- package/dist/api/types/Language.js +19 -0
- package/dist/api/types/LanguageIdentificationResponse.d.ts +39 -0
- package/dist/api/types/LanguageIdentificationResponse.js +5 -0
- package/dist/api/types/NumeralsFormat.d.ts +8 -0
- package/dist/api/types/NumeralsFormat.js +10 -0
- package/dist/api/types/ParsedPageResponse.d.ts +7 -0
- package/dist/api/types/ParsedPageResponse.js +5 -0
- package/dist/api/types/PromptCaching.d.ts +8 -0
- package/dist/api/types/PromptCaching.js +10 -0
- package/dist/api/types/QnaResponse.d.ts +15 -0
- package/dist/api/types/QnaResponse.js +5 -0
- package/dist/api/types/Question.d.ts +23 -0
- package/dist/api/types/Question.js +5 -0
- package/dist/api/types/QuestionType.d.ts +11 -0
- package/dist/api/types/QuestionType.js +13 -0
- package/dist/api/types/SarvamMode.d.ts +8 -0
- package/dist/api/types/SarvamMode.js +10 -0
- package/dist/api/types/SpeechSampleRate.d.ts +4 -0
- package/dist/api/types/SpeechSampleRate.js +5 -0
- package/dist/api/types/SpeechToTextLanguage.d.ts +18 -0
- package/dist/api/types/SpeechToTextLanguage.js +20 -0
- package/dist/api/types/SpeechToTextModel.d.ts +9 -0
- package/dist/api/types/SpeechToTextModel.js +11 -0
- package/dist/api/types/SpeechToTextResponse.d.ts +15 -0
- package/dist/api/types/SpeechToTextResponse.js +5 -0
- package/dist/api/types/SpeechToTextTranslateLanguage.d.ts +17 -0
- package/dist/api/types/SpeechToTextTranslateLanguage.js +19 -0
- package/dist/api/types/SpeechToTextTranslateModel.d.ts +10 -0
- package/dist/api/types/SpeechToTextTranslateModel.js +12 -0
- package/dist/api/types/SpeechToTextTranslateResponse.d.ts +13 -0
- package/dist/api/types/SpeechToTextTranslateResponse.js +5 -0
- package/dist/api/types/SpokenFormNumeralsFormat.d.ts +8 -0
- package/dist/api/types/SpokenFormNumeralsFormat.js +10 -0
- package/dist/api/types/TextAnalyticsRequest.d.ts +9 -0
- package/dist/api/types/TextAnalyticsRequest.js +5 -0
- package/dist/api/types/TextAnalyticsResponse.d.ts +9 -0
- package/dist/api/types/TextAnalyticsResponse.js +5 -0
- package/dist/api/types/TextToSpeechLanguage.d.ts +17 -0
- package/dist/api/types/TextToSpeechLanguage.js +19 -0
- package/dist/api/types/TextToSpeechModel.d.ts +4 -0
- package/dist/api/types/TextToSpeechModel.js +5 -0
- package/dist/api/types/TextToSpeechResponse.d.ts +8 -0
- package/dist/api/types/TextToSpeechResponse.js +5 -0
- package/dist/api/types/TextToSpeechSpeaker.d.ts +18 -0
- package/dist/api/types/TextToSpeechSpeaker.js +20 -0
- package/dist/api/types/TimestampsModel.d.ts +11 -0
- package/dist/api/types/TimestampsModel.js +5 -0
- package/dist/api/types/TranslateMode.d.ts +10 -0
- package/dist/api/types/TranslateMode.js +12 -0
- package/dist/api/types/TranslateModel.d.ts +4 -0
- package/dist/api/types/TranslateModel.js +5 -0
- package/dist/api/types/TranslatePostprocessing.d.ts +9 -0
- package/dist/api/types/TranslatePostprocessing.js +11 -0
- package/dist/api/types/TranslateSourceLanguage.d.ts +18 -0
- package/dist/api/types/TranslateSourceLanguage.js +20 -0
- package/dist/api/types/TranslateSpeakerGender.d.ts +8 -0
- package/dist/api/types/TranslateSpeakerGender.js +10 -0
- package/dist/api/types/TranslateTargetLanguage.d.ts +17 -0
- package/dist/api/types/TranslateTargetLanguage.js +19 -0
- package/dist/api/types/TranslatedPage.d.ts +7 -0
- package/dist/api/types/TranslatedPage.js +5 -0
- package/dist/api/types/TranslationResponse.d.ts +10 -0
- package/dist/api/types/TranslationResponse.js +5 -0
- package/dist/api/types/TranslatiterateTargetLanguage.d.ts +17 -0
- package/dist/api/types/TranslatiterateTargetLanguage.js +19 -0
- package/dist/api/types/TransliterateSourceLanguage.d.ts +18 -0
- package/dist/api/types/TransliterateSourceLanguage.js +20 -0
- package/dist/api/types/TransliterationResponse.d.ts +10 -0
- package/dist/api/types/TransliterationResponse.js +5 -0
- package/dist/api/types/index.d.ts +43 -0
- package/dist/api/types/index.js +59 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +39 -0
- package/dist/core/fetcher/Fetcher.js +100 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +22 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +12 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +68 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +11 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +54 -0
- package/dist/core/fetcher/index.d.ts +5 -0
- package/dist/core/fetcher/index.js +9 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +40 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +60 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +188 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +19 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +103 -0
- package/dist/environments.d.ts +8 -0
- package/dist/environments.js +10 -0
- package/dist/errors/SarvamError.d.ts +12 -0
- package/dist/errors/SarvamError.js +33 -0
- package/dist/errors/SarvamTimeoutError.d.ts +6 -0
- package/dist/errors/SarvamTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/environments.d.ts +8 -0
- package/environments.js +10 -0
- package/errors/SarvamError.d.ts +12 -0
- package/errors/SarvamError.js +33 -0
- package/errors/SarvamTimeoutError.d.ts +6 -0
- package/errors/SarvamTimeoutError.js +13 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.js +7 -0
- package/index.d.ts +4 -0
- package/index.js +44 -0
- package/jest.config.mjs +8 -0
- package/package.json +43 -0
- package/reference.md +768 -0
- package/scripts/rename-to-esm-files.js +115 -0
- package/version.d.ts +1 -0
- package/version.js +4 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.SpeechToText = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const Sarvam = __importStar(require("../../../index"));
|
|
55
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
57
|
+
class SpeechToText {
|
|
58
|
+
constructor(_options = {}) {
|
|
59
|
+
this._options = _options;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* ## Real-Time Speech to Text API
|
|
63
|
+
*
|
|
64
|
+
* This API transcribes speech to text in multiple Indian languages and English. Supports real-time transcription for interactive applications.
|
|
65
|
+
*
|
|
66
|
+
* ### Available Options:
|
|
67
|
+
* - **Real-Time API** (Current Endpoint): For quick responses under 30 seconds with immediate results
|
|
68
|
+
* - **Batch API**: For longer audio files, requires following a notebook script - [View Notebook](https://github.com/sarvamai/sarvam-ai-cookbook/tree/main/notebooks/stt/stt-batch-api)
|
|
69
|
+
* - Supports diarization (speaker identification)
|
|
70
|
+
*
|
|
71
|
+
* ### Note:
|
|
72
|
+
* - Pricing differs for Real-Time and Batch APIs
|
|
73
|
+
* - Diarization is only available in Batch API with separate pricing
|
|
74
|
+
* - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
|
|
75
|
+
*
|
|
76
|
+
* @param {File | fs.ReadStream | Blob} file
|
|
77
|
+
* @param {Sarvam.SpeechToTextTranscriptionRequest} request
|
|
78
|
+
* @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
+
*
|
|
80
|
+
* @throws {@link Sarvam.BadRequestError}
|
|
81
|
+
* @throws {@link Sarvam.ForbiddenError}
|
|
82
|
+
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
83
|
+
* @throws {@link Sarvam.TooManyRequestsError}
|
|
84
|
+
* @throws {@link Sarvam.InternalServerError}
|
|
85
|
+
* @throws {@link Sarvam.ServiceUnavailableError}
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* await client.speechToText.transcribe(fs.createReadStream("/path/to/your/file"), {})
|
|
89
|
+
*/
|
|
90
|
+
transcribe(file, request, requestOptions) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
const _request = yield core.newFormData();
|
|
94
|
+
yield _request.appendFile("file", file);
|
|
95
|
+
if (request.model != null) {
|
|
96
|
+
_request.append("model", request.model);
|
|
97
|
+
}
|
|
98
|
+
if (request.language_code != null) {
|
|
99
|
+
_request.append("language_code", request.language_code);
|
|
100
|
+
}
|
|
101
|
+
if (request.with_timestamps != null) {
|
|
102
|
+
_request.append("with_timestamps", request.with_timestamps.toString());
|
|
103
|
+
}
|
|
104
|
+
if (request.with_diarization != null) {
|
|
105
|
+
_request.append("with_diarization", request.with_diarization.toString());
|
|
106
|
+
}
|
|
107
|
+
if (request.num_speakers != null) {
|
|
108
|
+
_request.append("num_speakers", request.num_speakers.toString());
|
|
109
|
+
}
|
|
110
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
111
|
+
const _response = yield core.fetcher({
|
|
112
|
+
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.SarvamEnvironment.Production, "speech-to-text"),
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
115
|
+
? yield core.Supplier.get(this._options.apiSubscriptionKey)
|
|
116
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
117
|
+
requestType: "file",
|
|
118
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
119
|
+
body: _maybeEncodedRequest.body,
|
|
120
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
121
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
122
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
123
|
+
});
|
|
124
|
+
if (_response.ok) {
|
|
125
|
+
return _response.body;
|
|
126
|
+
}
|
|
127
|
+
if (_response.error.reason === "status-code") {
|
|
128
|
+
switch (_response.error.statusCode) {
|
|
129
|
+
case 400:
|
|
130
|
+
throw new Sarvam.BadRequestError(_response.error.body);
|
|
131
|
+
case 403:
|
|
132
|
+
throw new Sarvam.ForbiddenError(_response.error.body);
|
|
133
|
+
case 422:
|
|
134
|
+
throw new Sarvam.UnprocessableEntityError(_response.error.body);
|
|
135
|
+
case 429:
|
|
136
|
+
throw new Sarvam.TooManyRequestsError(_response.error.body);
|
|
137
|
+
case 500:
|
|
138
|
+
throw new Sarvam.InternalServerError(_response.error.body);
|
|
139
|
+
case 503:
|
|
140
|
+
throw new Sarvam.ServiceUnavailableError(_response.error.body);
|
|
141
|
+
default:
|
|
142
|
+
throw new errors.SarvamError({
|
|
143
|
+
statusCode: _response.error.statusCode,
|
|
144
|
+
body: _response.error.body,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
switch (_response.error.reason) {
|
|
149
|
+
case "non-json":
|
|
150
|
+
throw new errors.SarvamError({
|
|
151
|
+
statusCode: _response.error.statusCode,
|
|
152
|
+
body: _response.error.rawBody,
|
|
153
|
+
});
|
|
154
|
+
case "timeout":
|
|
155
|
+
throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /speech-to-text.");
|
|
156
|
+
case "unknown":
|
|
157
|
+
throw new errors.SarvamError({
|
|
158
|
+
message: _response.error.errorMessage,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* ## Real-Time Speech to Text Translation API
|
|
165
|
+
*
|
|
166
|
+
* This API automatically detects the input language, transcribes the speech, and translates the text to English.
|
|
167
|
+
*
|
|
168
|
+
* ### Available Options:
|
|
169
|
+
* - **Real-Time API** (Current Endpoint): For quick responses under 30 seconds with immediate results
|
|
170
|
+
* - **Batch API**: For longer audio files, requires following a notebook script - [View Notebook](https://github.com/sarvamai/sarvam-ai-cookbook/tree/main/notebooks/stt-translate/stt-translate-batch-api)
|
|
171
|
+
* - Supports diarization (speaker identification)
|
|
172
|
+
*
|
|
173
|
+
* ### Note:
|
|
174
|
+
* - Pricing differs for Real-Time and Batch APIs
|
|
175
|
+
* - Diarization is only available in Batch API with separate pricing
|
|
176
|
+
* - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
|
|
177
|
+
*
|
|
178
|
+
* @param {File | fs.ReadStream | Blob} file
|
|
179
|
+
* @param {Sarvam.SpeechToTextTranslationRequest} request
|
|
180
|
+
* @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
|
|
181
|
+
*
|
|
182
|
+
* @throws {@link Sarvam.BadRequestError}
|
|
183
|
+
* @throws {@link Sarvam.ForbiddenError}
|
|
184
|
+
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
185
|
+
* @throws {@link Sarvam.TooManyRequestsError}
|
|
186
|
+
* @throws {@link Sarvam.InternalServerError}
|
|
187
|
+
* @throws {@link Sarvam.ServiceUnavailableError}
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* await client.speechToText.translate(fs.createReadStream("/path/to/your/file"), {})
|
|
191
|
+
*/
|
|
192
|
+
translate(file, request, requestOptions) {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
const _request = yield core.newFormData();
|
|
196
|
+
yield _request.appendFile("file", file);
|
|
197
|
+
if (request.prompt != null) {
|
|
198
|
+
_request.append("prompt", request.prompt);
|
|
199
|
+
}
|
|
200
|
+
if (request.model != null) {
|
|
201
|
+
_request.append("model", request.model);
|
|
202
|
+
}
|
|
203
|
+
if (request.with_diarization != null) {
|
|
204
|
+
_request.append("with_diarization", request.with_diarization.toString());
|
|
205
|
+
}
|
|
206
|
+
if (request.num_speakers != null) {
|
|
207
|
+
_request.append("num_speakers", request.num_speakers.toString());
|
|
208
|
+
}
|
|
209
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
210
|
+
const _response = yield core.fetcher({
|
|
211
|
+
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.SarvamEnvironment.Production, "speech-to-text-translate"),
|
|
212
|
+
method: "POST",
|
|
213
|
+
headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
214
|
+
? yield core.Supplier.get(this._options.apiSubscriptionKey)
|
|
215
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
216
|
+
requestType: "file",
|
|
217
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
218
|
+
body: _maybeEncodedRequest.body,
|
|
219
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
220
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
221
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
222
|
+
});
|
|
223
|
+
if (_response.ok) {
|
|
224
|
+
return _response.body;
|
|
225
|
+
}
|
|
226
|
+
if (_response.error.reason === "status-code") {
|
|
227
|
+
switch (_response.error.statusCode) {
|
|
228
|
+
case 400:
|
|
229
|
+
throw new Sarvam.BadRequestError(_response.error.body);
|
|
230
|
+
case 403:
|
|
231
|
+
throw new Sarvam.ForbiddenError(_response.error.body);
|
|
232
|
+
case 422:
|
|
233
|
+
throw new Sarvam.UnprocessableEntityError(_response.error.body);
|
|
234
|
+
case 429:
|
|
235
|
+
throw new Sarvam.TooManyRequestsError(_response.error.body);
|
|
236
|
+
case 500:
|
|
237
|
+
throw new Sarvam.InternalServerError(_response.error.body);
|
|
238
|
+
case 503:
|
|
239
|
+
throw new Sarvam.ServiceUnavailableError(_response.error.body);
|
|
240
|
+
default:
|
|
241
|
+
throw new errors.SarvamError({
|
|
242
|
+
statusCode: _response.error.statusCode,
|
|
243
|
+
body: _response.error.body,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
switch (_response.error.reason) {
|
|
248
|
+
case "non-json":
|
|
249
|
+
throw new errors.SarvamError({
|
|
250
|
+
statusCode: _response.error.statusCode,
|
|
251
|
+
body: _response.error.rawBody,
|
|
252
|
+
});
|
|
253
|
+
case "timeout":
|
|
254
|
+
throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /speech-to-text-translate.");
|
|
255
|
+
case "unknown":
|
|
256
|
+
throw new errors.SarvamError({
|
|
257
|
+
message: _response.error.errorMessage,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.SpeechToText = SpeechToText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Sarvam from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {}
|
|
8
|
+
*/
|
|
9
|
+
export interface SpeechToTextTranscriptionRequest {
|
|
10
|
+
/**
|
|
11
|
+
* Specifies the model to use for speech-to-text conversion.
|
|
12
|
+
* Note:- Default model is `saarika:v2`
|
|
13
|
+
*/
|
|
14
|
+
model?: Sarvam.SpeechToTextModel;
|
|
15
|
+
/**
|
|
16
|
+
* Specifies the language of the input audio. This parameter is required to ensure accurate transcription.
|
|
17
|
+
* For the `saarika:v1` model, this parameter is mandatory.
|
|
18
|
+
* For the `saarika:v2` model, it is optional.
|
|
19
|
+
* `unknown`: Use this when the language is not known; the API will detect it automatically.
|
|
20
|
+
* Note:- that the `saarika:v1` model does not support `unknown` language code.
|
|
21
|
+
*/
|
|
22
|
+
language_code?: Sarvam.SpeechToTextLanguage;
|
|
23
|
+
/** Enables timestamps in the response. If set to `true`, the response will include timestamps in the transcript. */
|
|
24
|
+
with_timestamps?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Enables speaker diarization, which identifies and separates different speakers in the audio.
|
|
27
|
+
* When set to true, the API will provide speaker-specific segments in the response.
|
|
28
|
+
* Note: This parameter is currently in Beta mode.
|
|
29
|
+
*/
|
|
30
|
+
with_diarization?: boolean;
|
|
31
|
+
/** Number of speakers to be detected in the audio. This is used when with_diarization is set to true. */
|
|
32
|
+
num_speakers?: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Sarvam from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {}
|
|
8
|
+
*/
|
|
9
|
+
export interface SpeechToTextTranslationRequest {
|
|
10
|
+
/** Conversation context can be passed as a prompt to boost model accuracy. However, the current system is at an experimentation stage and doesn’t match the prompt performance of large language models. */
|
|
11
|
+
prompt?: string;
|
|
12
|
+
/** Model to be used for converting speech to text in target language */
|
|
13
|
+
model?: Sarvam.SpeechToTextTranslateModel;
|
|
14
|
+
/**
|
|
15
|
+
* Enables speaker diarization, which identifies and separates different speakers in the audio.
|
|
16
|
+
* When set to true, the API will provide speaker-specific segments in the response.
|
|
17
|
+
* Note: This parameter is currently in Beta mode.
|
|
18
|
+
*/
|
|
19
|
+
with_diarization?: boolean;
|
|
20
|
+
/** Number of speakers to be detected in the audio. This is used when with_diarization is set to true. */
|
|
21
|
+
num_speakers?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client"), exports);
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
5
|
+
import * as core from "../../../../core";
|
|
6
|
+
import * as Sarvam from "../../../index";
|
|
7
|
+
export declare namespace Text {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.SarvamEnvironment | string>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
12
|
+
/** Override the api-subscription-key header */
|
|
13
|
+
apiSubscriptionKey?: core.Supplier<string | undefined>;
|
|
14
|
+
}
|
|
15
|
+
interface RequestOptions {
|
|
16
|
+
/** The maximum time to wait for a response in seconds. */
|
|
17
|
+
timeoutInSeconds?: number;
|
|
18
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
/** A hook to abort the request. */
|
|
21
|
+
abortSignal?: AbortSignal;
|
|
22
|
+
/** Override the api-subscription-key header */
|
|
23
|
+
apiSubscriptionKey?: string | undefined;
|
|
24
|
+
/** Additional headers to include in the request. */
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare class Text {
|
|
29
|
+
protected readonly _options: Text.Options;
|
|
30
|
+
constructor(_options?: Text.Options);
|
|
31
|
+
/**
|
|
32
|
+
* **Translation** converts text from one language to another while preserving its meaning.
|
|
33
|
+
* For Example: **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, where the script and language change, but the original meaning remains the same.
|
|
34
|
+
*
|
|
35
|
+
* Available languages:
|
|
36
|
+
* - **`en-IN`**: English
|
|
37
|
+
* - **`hi-IN`**: Hindi
|
|
38
|
+
* - **`bn-IN`**: Bengali
|
|
39
|
+
* - **`gu-IN`**: Gujarati
|
|
40
|
+
* - **`kn-IN`**: Kannada
|
|
41
|
+
* - **`ml-IN`**: Malayalam
|
|
42
|
+
* - **`mr-IN`**: Marathi
|
|
43
|
+
* - **`od-IN`**: Odia
|
|
44
|
+
* - **`pa-IN`**: Punjabi
|
|
45
|
+
* - **`ta-IN`**: Tamil
|
|
46
|
+
* - **`te-IN`**: Telugu
|
|
47
|
+
*
|
|
48
|
+
* For hands-on practice, you can explore the notebook tutorial on [Translate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/translate/Translate_API_Tutorial.ipynb).
|
|
49
|
+
*
|
|
50
|
+
* @param {Sarvam.TranslationRequest} request
|
|
51
|
+
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link Sarvam.BadRequestError}
|
|
54
|
+
* @throws {@link Sarvam.ForbiddenError}
|
|
55
|
+
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
56
|
+
* @throws {@link Sarvam.TooManyRequestsError}
|
|
57
|
+
* @throws {@link Sarvam.InternalServerError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.text.translate({
|
|
61
|
+
* input: "input",
|
|
62
|
+
* source_language_code: "auto",
|
|
63
|
+
* target_language_code: "en-IN"
|
|
64
|
+
* })
|
|
65
|
+
*/
|
|
66
|
+
translate(request: Sarvam.TranslationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.TranslationResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
|
|
69
|
+
*
|
|
70
|
+
* @param {Sarvam.LanguageIdentificationRequest} request
|
|
71
|
+
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
|
+
*
|
|
73
|
+
* @throws {@link Sarvam.BadRequestError}
|
|
74
|
+
* @throws {@link Sarvam.ForbiddenError}
|
|
75
|
+
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
76
|
+
* @throws {@link Sarvam.TooManyRequestsError}
|
|
77
|
+
* @throws {@link Sarvam.InternalServerError}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* await client.text.identifyLanguage({
|
|
81
|
+
* input: "input"
|
|
82
|
+
* })
|
|
83
|
+
*/
|
|
84
|
+
identifyLanguage(request: Sarvam.LanguageIdentificationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.LanguageIdentificationResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* **Transliteration** converts text from one script to another while preserving the original pronunciation. For example, **'नमस्ते'** becomes **'namaste'** in English, and **'how are you'** can be written as **'हाउ आर यू'** in Devanagari. This process ensures that the sound of the original text remains intact, even when written in a different script.
|
|
87
|
+
*
|
|
88
|
+
* Transliteration is useful when you want to represent words phonetically across different writing systems, such as converting **'मैं ऑफिस जा रहा हूँ'** to **'main office ja raha hun'** in English letters.
|
|
89
|
+
*
|
|
90
|
+
* **Translation**, on the other hand, converts text from one language to another while preserving the meaning rather than pronunciation. For example, **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, changing both the script and the language while conveying the intended message.
|
|
91
|
+
* ### Examples of **Transliteration**:
|
|
92
|
+
* - **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
|
|
93
|
+
* - **'सुप्रभात'** becomes **'suprabhat'** in English.
|
|
94
|
+
*
|
|
95
|
+
* Available languages:
|
|
96
|
+
* - **`en-IN`**: English
|
|
97
|
+
* - **`hi-IN`**: Hindi
|
|
98
|
+
* - **`bn-IN`**: Bengali
|
|
99
|
+
* - **`gu-IN`**: Gujarati
|
|
100
|
+
* - **`kn-IN`**: Kannada
|
|
101
|
+
* - **`ml-IN`**: Malayalam
|
|
102
|
+
* - **`mr-IN`**: Marathi
|
|
103
|
+
* - **`od-IN`**: Odia
|
|
104
|
+
* - **`pa-IN`**: Punjabi
|
|
105
|
+
* - **`ta-IN`**: Tamil
|
|
106
|
+
* - **`te-IN`**: Telugu
|
|
107
|
+
*
|
|
108
|
+
* For hands-on practice, you can explore the notebook tutorial on [Transliterate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/transliterate/Transliterate_API_Tutorial.ipynb).
|
|
109
|
+
*
|
|
110
|
+
* @param {Sarvam.TransliterationRequest} request
|
|
111
|
+
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
112
|
+
*
|
|
113
|
+
* @throws {@link Sarvam.BadRequestError}
|
|
114
|
+
* @throws {@link Sarvam.ForbiddenError}
|
|
115
|
+
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
116
|
+
* @throws {@link Sarvam.TooManyRequestsError}
|
|
117
|
+
* @throws {@link Sarvam.InternalServerError}
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* await client.text.transliterate({
|
|
121
|
+
* input: "input",
|
|
122
|
+
* source_language_code: "auto",
|
|
123
|
+
* target_language_code: "en-IN"
|
|
124
|
+
* })
|
|
125
|
+
*/
|
|
126
|
+
transliterate(request: Sarvam.TransliterationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.TransliterationResponse>;
|
|
127
|
+
}
|