sarvamai 0.0.2 → 1.0.0
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/package.json +19 -41
- package/src/index.ts +9 -0
- package/src/resources/base.ts +18 -0
- package/src/resources/posts/index.ts +0 -0
- package/src/resources/posts/types.ts +0 -0
- package/src/resources/users/index.ts +0 -0
- package/src/resources/users/types.ts +0 -0
- package/src/resources/users.ts +7 -0
- package/tsconfig.json +15 -0
- package/Client.d.ts +0 -45
- package/Client.js +0 -37
- package/README.md +0 -159
- package/api/errors/BadRequestError.d.ts +0 -7
- package/api/errors/BadRequestError.js +0 -51
- package/api/errors/ForbiddenError.d.ts +0 -8
- package/api/errors/ForbiddenError.js +0 -51
- package/api/errors/InternalServerError.d.ts +0 -7
- package/api/errors/InternalServerError.js +0 -51
- package/api/errors/ServiceUnavailableError.d.ts +0 -8
- package/api/errors/ServiceUnavailableError.js +0 -51
- package/api/errors/TooManyRequestsError.d.ts +0 -8
- package/api/errors/TooManyRequestsError.js +0 -51
- package/api/errors/UnprocessableEntityError.d.ts +0 -7
- package/api/errors/UnprocessableEntityError.js +0 -51
- package/api/errors/index.d.ts +0 -6
- package/api/errors/index.js +0 -22
- package/api/index.d.ts +0 -3
- package/api/index.js +0 -19
- package/api/resources/analytics/client/Client.d.ts +0 -73
- package/api/resources/analytics/client/Client.js +0 -223
- package/api/resources/analytics/client/index.d.ts +0 -1
- package/api/resources/analytics/client/index.js +0 -17
- package/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +0 -24
- package/api/resources/analytics/client/requests/CallAnalyticsRequest.js +0 -5
- package/api/resources/analytics/client/requests/index.d.ts +0 -1
- package/api/resources/analytics/client/requests/index.js +0 -2
- package/api/resources/analytics/index.d.ts +0 -1
- package/api/resources/analytics/index.js +0 -17
- package/api/resources/index.d.ts +0 -10
- package/api/resources/index.js +0 -49
- package/api/resources/pdf/client/Client.d.ts +0 -63
- package/api/resources/pdf/client/Client.js +0 -215
- package/api/resources/pdf/client/index.d.ts +0 -1
- package/api/resources/pdf/client/index.js +0 -17
- package/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +0 -21
- package/api/resources/pdf/client/requests/ParsePdfRequest.js +0 -5
- package/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +0 -32
- package/api/resources/pdf/client/requests/TranslatePdfRequest.js +0 -5
- package/api/resources/pdf/client/requests/index.d.ts +0 -2
- package/api/resources/pdf/client/requests/index.js +0 -2
- package/api/resources/pdf/index.d.ts +0 -1
- package/api/resources/pdf/index.js +0 -17
- package/api/resources/speechToText/client/Client.d.ts +0 -93
- package/api/resources/speechToText/client/Client.js +0 -263
- package/api/resources/speechToText/client/index.d.ts +0 -1
- package/api/resources/speechToText/client/index.js +0 -17
- package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +0 -33
- package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.js +0 -5
- package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +0 -22
- package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.js +0 -5
- package/api/resources/speechToText/client/requests/index.d.ts +0 -2
- package/api/resources/speechToText/client/requests/index.js +0 -2
- package/api/resources/speechToText/index.d.ts +0 -1
- package/api/resources/speechToText/index.js +0 -17
- package/api/resources/text/client/Client.d.ts +0 -127
- package/api/resources/text/client/Client.js +0 -314
- package/api/resources/text/client/index.d.ts +0 -1
- package/api/resources/text/client/index.js +0 -17
- package/api/resources/text/client/requests/LanguageIdentificationRequest.d.ts +0 -13
- package/api/resources/text/client/requests/LanguageIdentificationRequest.js +0 -5
- package/api/resources/text/client/requests/TranslationRequest.d.ts +0 -77
- package/api/resources/text/client/requests/TranslationRequest.js +0 -5
- package/api/resources/text/client/requests/TransliterationRequest.d.ts +0 -68
- package/api/resources/text/client/requests/TransliterationRequest.js +0 -5
- package/api/resources/text/client/requests/index.d.ts +0 -3
- package/api/resources/text/client/requests/index.js +0 -2
- package/api/resources/text/index.d.ts +0 -1
- package/api/resources/text/index.js +0 -17
- package/api/resources/textToSpeech/client/Client.d.ts +0 -51
- package/api/resources/textToSpeech/client/Client.js +0 -134
- package/api/resources/textToSpeech/client/index.d.ts +0 -1
- package/api/resources/textToSpeech/client/index.js +0 -17
- package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +0 -35
- package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.js +0 -5
- package/api/resources/textToSpeech/client/requests/index.d.ts +0 -1
- package/api/resources/textToSpeech/client/requests/index.js +0 -2
- package/api/resources/textToSpeech/index.d.ts +0 -1
- package/api/resources/textToSpeech/index.js +0 -17
- package/api/types/CallAnalyticsJobParameters.d.ts +0 -21
- package/api/types/CallAnalyticsJobParameters.js +0 -5
- package/api/types/CallAnalyticsJobRequest.d.ts +0 -10
- package/api/types/CallAnalyticsJobRequest.js +0 -5
- package/api/types/CallAnalyticsResponse.d.ts +0 -19
- package/api/types/CallAnalyticsResponse.js +0 -5
- package/api/types/DiarizedEntry.d.ts +0 -13
- package/api/types/DiarizedEntry.js +0 -5
- package/api/types/DiarizedTranscript.d.ts +0 -8
- package/api/types/DiarizedTranscript.js +0 -5
- package/api/types/ErrorCode.d.ts +0 -16
- package/api/types/ErrorCode.js +0 -18
- package/api/types/ErrorDetails.d.ts +0 -10
- package/api/types/ErrorDetails.js +0 -5
- package/api/types/ErrorMessage.d.ts +0 -8
- package/api/types/ErrorMessage.js +0 -5
- package/api/types/Language.d.ts +0 -17
- package/api/types/Language.js +0 -19
- package/api/types/LanguageIdentificationResponse.d.ts +0 -39
- package/api/types/LanguageIdentificationResponse.js +0 -5
- package/api/types/NumeralsFormat.d.ts +0 -8
- package/api/types/NumeralsFormat.js +0 -10
- package/api/types/ParsedPageResponse.d.ts +0 -7
- package/api/types/ParsedPageResponse.js +0 -5
- package/api/types/PromptCaching.d.ts +0 -8
- package/api/types/PromptCaching.js +0 -10
- package/api/types/QnaResponse.d.ts +0 -15
- package/api/types/QnaResponse.js +0 -5
- package/api/types/Question.d.ts +0 -23
- package/api/types/Question.js +0 -5
- package/api/types/QuestionType.d.ts +0 -11
- package/api/types/QuestionType.js +0 -13
- package/api/types/SarvamMode.d.ts +0 -8
- package/api/types/SarvamMode.js +0 -10
- package/api/types/SpeechSampleRate.d.ts +0 -4
- package/api/types/SpeechSampleRate.js +0 -5
- package/api/types/SpeechToTextLanguage.d.ts +0 -18
- package/api/types/SpeechToTextLanguage.js +0 -20
- package/api/types/SpeechToTextModel.d.ts +0 -9
- package/api/types/SpeechToTextModel.js +0 -11
- package/api/types/SpeechToTextResponse.d.ts +0 -15
- package/api/types/SpeechToTextResponse.js +0 -5
- package/api/types/SpeechToTextTranslateLanguage.d.ts +0 -17
- package/api/types/SpeechToTextTranslateLanguage.js +0 -19
- package/api/types/SpeechToTextTranslateModel.d.ts +0 -10
- package/api/types/SpeechToTextTranslateModel.js +0 -12
- package/api/types/SpeechToTextTranslateResponse.d.ts +0 -13
- package/api/types/SpeechToTextTranslateResponse.js +0 -5
- package/api/types/SpokenFormNumeralsFormat.d.ts +0 -8
- package/api/types/SpokenFormNumeralsFormat.js +0 -10
- package/api/types/TextAnalyticsRequest.d.ts +0 -9
- package/api/types/TextAnalyticsRequest.js +0 -5
- package/api/types/TextAnalyticsResponse.d.ts +0 -9
- package/api/types/TextAnalyticsResponse.js +0 -5
- package/api/types/TextToSpeechLanguage.d.ts +0 -17
- package/api/types/TextToSpeechLanguage.js +0 -19
- package/api/types/TextToSpeechModel.d.ts +0 -4
- package/api/types/TextToSpeechModel.js +0 -5
- package/api/types/TextToSpeechResponse.d.ts +0 -8
- package/api/types/TextToSpeechResponse.js +0 -5
- package/api/types/TextToSpeechSpeaker.d.ts +0 -18
- package/api/types/TextToSpeechSpeaker.js +0 -20
- package/api/types/TimestampsModel.d.ts +0 -11
- package/api/types/TimestampsModel.js +0 -5
- package/api/types/TranslateMode.d.ts +0 -10
- package/api/types/TranslateMode.js +0 -12
- package/api/types/TranslateModel.d.ts +0 -4
- package/api/types/TranslateModel.js +0 -5
- package/api/types/TranslatePostprocessing.d.ts +0 -9
- package/api/types/TranslatePostprocessing.js +0 -11
- package/api/types/TranslateSourceLanguage.d.ts +0 -18
- package/api/types/TranslateSourceLanguage.js +0 -20
- package/api/types/TranslateSpeakerGender.d.ts +0 -8
- package/api/types/TranslateSpeakerGender.js +0 -10
- package/api/types/TranslateTargetLanguage.d.ts +0 -17
- package/api/types/TranslateTargetLanguage.js +0 -19
- package/api/types/TranslatedPage.d.ts +0 -7
- package/api/types/TranslatedPage.js +0 -5
- package/api/types/TranslationResponse.d.ts +0 -10
- package/api/types/TranslationResponse.js +0 -5
- package/api/types/TranslatiterateTargetLanguage.d.ts +0 -17
- package/api/types/TranslatiterateTargetLanguage.js +0 -19
- package/api/types/TransliterateSourceLanguage.d.ts +0 -18
- package/api/types/TransliterateSourceLanguage.js +0 -20
- package/api/types/TransliterationResponse.d.ts +0 -10
- package/api/types/TransliterationResponse.js +0 -5
- package/api/types/index.d.ts +0 -43
- package/api/types/index.js +0 -59
- package/core/fetcher/APIResponse.d.ts +0 -10
- package/core/fetcher/APIResponse.js +0 -2
- package/core/fetcher/Fetcher.d.ts +0 -39
- package/core/fetcher/Fetcher.js +0 -100
- package/core/fetcher/Supplier.d.ts +0 -4
- package/core/fetcher/Supplier.js +0 -22
- package/core/fetcher/createRequestUrl.d.ts +0 -1
- package/core/fetcher/createRequestUrl.js +0 -12
- package/core/fetcher/getFetchFn.d.ts +0 -4
- package/core/fetcher/getFetchFn.js +0 -68
- package/core/fetcher/getHeader.d.ts +0 -1
- package/core/fetcher/getHeader.js +0 -11
- package/core/fetcher/getRequestBody.d.ts +0 -7
- package/core/fetcher/getRequestBody.js +0 -23
- package/core/fetcher/getResponseBody.d.ts +0 -1
- package/core/fetcher/getResponseBody.js +0 -54
- package/core/fetcher/index.d.ts +0 -5
- package/core/fetcher/index.js +0 -9
- package/core/fetcher/makeRequest.d.ts +0 -1
- package/core/fetcher/makeRequest.js +0 -42
- package/core/fetcher/requestWithRetries.d.ts +0 -1
- package/core/fetcher/requestWithRetries.js +0 -40
- package/core/fetcher/signals.d.ts +0 -11
- package/core/fetcher/signals.js +0 -36
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/core/form-data-utils/FormDataWrapper.d.ts +0 -60
- package/core/form-data-utils/FormDataWrapper.js +0 -188
- package/core/form-data-utils/encodeAsFormParameter.d.ts +0 -4
- package/core/form-data-utils/encodeAsFormParameter.js +0 -18
- package/core/form-data-utils/index.d.ts +0 -2
- package/core/form-data-utils/index.js +0 -20
- package/core/index.d.ts +0 -3
- package/core/index.js +0 -19
- package/core/json.d.ts +0 -15
- package/core/json.js +0 -24
- package/core/runtime/index.d.ts +0 -1
- package/core/runtime/index.js +0 -5
- package/core/runtime/runtime.d.ts +0 -9
- package/core/runtime/runtime.js +0 -103
- package/dist/Client.d.ts +0 -45
- package/dist/Client.js +0 -37
- package/dist/api/errors/BadRequestError.d.ts +0 -7
- package/dist/api/errors/BadRequestError.js +0 -51
- package/dist/api/errors/ForbiddenError.d.ts +0 -8
- package/dist/api/errors/ForbiddenError.js +0 -51
- package/dist/api/errors/InternalServerError.d.ts +0 -7
- package/dist/api/errors/InternalServerError.js +0 -51
- package/dist/api/errors/ServiceUnavailableError.d.ts +0 -8
- package/dist/api/errors/ServiceUnavailableError.js +0 -51
- package/dist/api/errors/TooManyRequestsError.d.ts +0 -8
- package/dist/api/errors/TooManyRequestsError.js +0 -51
- package/dist/api/errors/UnprocessableEntityError.d.ts +0 -7
- package/dist/api/errors/UnprocessableEntityError.js +0 -51
- package/dist/api/errors/index.d.ts +0 -6
- package/dist/api/errors/index.js +0 -22
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -19
- package/dist/api/resources/analytics/client/Client.d.ts +0 -73
- package/dist/api/resources/analytics/client/Client.js +0 -223
- package/dist/api/resources/analytics/client/index.d.ts +0 -1
- package/dist/api/resources/analytics/client/index.js +0 -17
- package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +0 -24
- package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.js +0 -5
- package/dist/api/resources/analytics/client/requests/index.d.ts +0 -1
- package/dist/api/resources/analytics/client/requests/index.js +0 -2
- package/dist/api/resources/analytics/index.d.ts +0 -1
- package/dist/api/resources/analytics/index.js +0 -17
- package/dist/api/resources/index.d.ts +0 -10
- package/dist/api/resources/index.js +0 -49
- package/dist/api/resources/pdf/client/Client.d.ts +0 -63
- package/dist/api/resources/pdf/client/Client.js +0 -215
- package/dist/api/resources/pdf/client/index.d.ts +0 -1
- package/dist/api/resources/pdf/client/index.js +0 -17
- package/dist/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +0 -21
- package/dist/api/resources/pdf/client/requests/ParsePdfRequest.js +0 -5
- package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +0 -32
- package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.js +0 -5
- package/dist/api/resources/pdf/client/requests/index.d.ts +0 -2
- package/dist/api/resources/pdf/client/requests/index.js +0 -2
- package/dist/api/resources/pdf/index.d.ts +0 -1
- package/dist/api/resources/pdf/index.js +0 -17
- package/dist/api/resources/speechToText/client/Client.d.ts +0 -93
- package/dist/api/resources/speechToText/client/Client.js +0 -263
- package/dist/api/resources/speechToText/client/index.d.ts +0 -1
- package/dist/api/resources/speechToText/client/index.js +0 -17
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +0 -33
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.js +0 -5
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +0 -22
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.js +0 -5
- package/dist/api/resources/speechToText/client/requests/index.d.ts +0 -2
- package/dist/api/resources/speechToText/client/requests/index.js +0 -2
- package/dist/api/resources/speechToText/index.d.ts +0 -1
- package/dist/api/resources/speechToText/index.js +0 -17
- package/dist/api/resources/text/client/Client.d.ts +0 -127
- package/dist/api/resources/text/client/Client.js +0 -314
- package/dist/api/resources/text/client/index.d.ts +0 -1
- package/dist/api/resources/text/client/index.js +0 -17
- package/dist/api/resources/text/client/requests/LanguageIdentificationRequest.d.ts +0 -13
- package/dist/api/resources/text/client/requests/LanguageIdentificationRequest.js +0 -5
- package/dist/api/resources/text/client/requests/TranslationRequest.d.ts +0 -77
- package/dist/api/resources/text/client/requests/TranslationRequest.js +0 -5
- package/dist/api/resources/text/client/requests/TransliterationRequest.d.ts +0 -68
- package/dist/api/resources/text/client/requests/TransliterationRequest.js +0 -5
- package/dist/api/resources/text/client/requests/index.d.ts +0 -3
- package/dist/api/resources/text/client/requests/index.js +0 -2
- package/dist/api/resources/text/index.d.ts +0 -1
- package/dist/api/resources/text/index.js +0 -17
- package/dist/api/resources/textToSpeech/client/Client.d.ts +0 -51
- package/dist/api/resources/textToSpeech/client/Client.js +0 -134
- package/dist/api/resources/textToSpeech/client/index.d.ts +0 -1
- package/dist/api/resources/textToSpeech/client/index.js +0 -17
- package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +0 -35
- package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.js +0 -5
- package/dist/api/resources/textToSpeech/client/requests/index.d.ts +0 -1
- package/dist/api/resources/textToSpeech/client/requests/index.js +0 -2
- package/dist/api/resources/textToSpeech/index.d.ts +0 -1
- package/dist/api/resources/textToSpeech/index.js +0 -17
- package/dist/api/types/CallAnalyticsJobParameters.d.ts +0 -21
- package/dist/api/types/CallAnalyticsJobParameters.js +0 -5
- package/dist/api/types/CallAnalyticsJobRequest.d.ts +0 -10
- package/dist/api/types/CallAnalyticsJobRequest.js +0 -5
- package/dist/api/types/CallAnalyticsResponse.d.ts +0 -19
- package/dist/api/types/CallAnalyticsResponse.js +0 -5
- package/dist/api/types/DiarizedEntry.d.ts +0 -13
- package/dist/api/types/DiarizedEntry.js +0 -5
- package/dist/api/types/DiarizedTranscript.d.ts +0 -8
- package/dist/api/types/DiarizedTranscript.js +0 -5
- package/dist/api/types/ErrorCode.d.ts +0 -16
- package/dist/api/types/ErrorCode.js +0 -18
- package/dist/api/types/ErrorDetails.d.ts +0 -10
- package/dist/api/types/ErrorDetails.js +0 -5
- package/dist/api/types/ErrorMessage.d.ts +0 -8
- package/dist/api/types/ErrorMessage.js +0 -5
- package/dist/api/types/Language.d.ts +0 -17
- package/dist/api/types/Language.js +0 -19
- package/dist/api/types/LanguageIdentificationResponse.d.ts +0 -39
- package/dist/api/types/LanguageIdentificationResponse.js +0 -5
- package/dist/api/types/NumeralsFormat.d.ts +0 -8
- package/dist/api/types/NumeralsFormat.js +0 -10
- package/dist/api/types/ParsedPageResponse.d.ts +0 -7
- package/dist/api/types/ParsedPageResponse.js +0 -5
- package/dist/api/types/PromptCaching.d.ts +0 -8
- package/dist/api/types/PromptCaching.js +0 -10
- package/dist/api/types/QnaResponse.d.ts +0 -15
- package/dist/api/types/QnaResponse.js +0 -5
- package/dist/api/types/Question.d.ts +0 -23
- package/dist/api/types/Question.js +0 -5
- package/dist/api/types/QuestionType.d.ts +0 -11
- package/dist/api/types/QuestionType.js +0 -13
- package/dist/api/types/SarvamMode.d.ts +0 -8
- package/dist/api/types/SarvamMode.js +0 -10
- package/dist/api/types/SpeechSampleRate.d.ts +0 -4
- package/dist/api/types/SpeechSampleRate.js +0 -5
- package/dist/api/types/SpeechToTextLanguage.d.ts +0 -18
- package/dist/api/types/SpeechToTextLanguage.js +0 -20
- package/dist/api/types/SpeechToTextModel.d.ts +0 -9
- package/dist/api/types/SpeechToTextModel.js +0 -11
- package/dist/api/types/SpeechToTextResponse.d.ts +0 -15
- package/dist/api/types/SpeechToTextResponse.js +0 -5
- package/dist/api/types/SpeechToTextTranslateLanguage.d.ts +0 -17
- package/dist/api/types/SpeechToTextTranslateLanguage.js +0 -19
- package/dist/api/types/SpeechToTextTranslateModel.d.ts +0 -10
- package/dist/api/types/SpeechToTextTranslateModel.js +0 -12
- package/dist/api/types/SpeechToTextTranslateResponse.d.ts +0 -13
- package/dist/api/types/SpeechToTextTranslateResponse.js +0 -5
- package/dist/api/types/SpokenFormNumeralsFormat.d.ts +0 -8
- package/dist/api/types/SpokenFormNumeralsFormat.js +0 -10
- package/dist/api/types/TextAnalyticsRequest.d.ts +0 -9
- package/dist/api/types/TextAnalyticsRequest.js +0 -5
- package/dist/api/types/TextAnalyticsResponse.d.ts +0 -9
- package/dist/api/types/TextAnalyticsResponse.js +0 -5
- package/dist/api/types/TextToSpeechLanguage.d.ts +0 -17
- package/dist/api/types/TextToSpeechLanguage.js +0 -19
- package/dist/api/types/TextToSpeechModel.d.ts +0 -4
- package/dist/api/types/TextToSpeechModel.js +0 -5
- package/dist/api/types/TextToSpeechResponse.d.ts +0 -8
- package/dist/api/types/TextToSpeechResponse.js +0 -5
- package/dist/api/types/TextToSpeechSpeaker.d.ts +0 -18
- package/dist/api/types/TextToSpeechSpeaker.js +0 -20
- package/dist/api/types/TimestampsModel.d.ts +0 -11
- package/dist/api/types/TimestampsModel.js +0 -5
- package/dist/api/types/TranslateMode.d.ts +0 -10
- package/dist/api/types/TranslateMode.js +0 -12
- package/dist/api/types/TranslateModel.d.ts +0 -4
- package/dist/api/types/TranslateModel.js +0 -5
- package/dist/api/types/TranslatePostprocessing.d.ts +0 -9
- package/dist/api/types/TranslatePostprocessing.js +0 -11
- package/dist/api/types/TranslateSourceLanguage.d.ts +0 -18
- package/dist/api/types/TranslateSourceLanguage.js +0 -20
- package/dist/api/types/TranslateSpeakerGender.d.ts +0 -8
- package/dist/api/types/TranslateSpeakerGender.js +0 -10
- package/dist/api/types/TranslateTargetLanguage.d.ts +0 -17
- package/dist/api/types/TranslateTargetLanguage.js +0 -19
- package/dist/api/types/TranslatedPage.d.ts +0 -7
- package/dist/api/types/TranslatedPage.js +0 -5
- package/dist/api/types/TranslationResponse.d.ts +0 -10
- package/dist/api/types/TranslationResponse.js +0 -5
- package/dist/api/types/TranslatiterateTargetLanguage.d.ts +0 -17
- package/dist/api/types/TranslatiterateTargetLanguage.js +0 -19
- package/dist/api/types/TransliterateSourceLanguage.d.ts +0 -18
- package/dist/api/types/TransliterateSourceLanguage.js +0 -20
- package/dist/api/types/TransliterationResponse.d.ts +0 -10
- package/dist/api/types/TransliterationResponse.js +0 -5
- package/dist/api/types/index.d.ts +0 -43
- package/dist/api/types/index.js +0 -59
- package/dist/core/fetcher/APIResponse.d.ts +0 -10
- package/dist/core/fetcher/APIResponse.js +0 -2
- package/dist/core/fetcher/Fetcher.d.ts +0 -39
- package/dist/core/fetcher/Fetcher.js +0 -100
- package/dist/core/fetcher/Supplier.d.ts +0 -4
- package/dist/core/fetcher/Supplier.js +0 -22
- package/dist/core/fetcher/createRequestUrl.d.ts +0 -1
- package/dist/core/fetcher/createRequestUrl.js +0 -12
- package/dist/core/fetcher/getFetchFn.d.ts +0 -4
- package/dist/core/fetcher/getFetchFn.js +0 -68
- package/dist/core/fetcher/getHeader.d.ts +0 -1
- package/dist/core/fetcher/getHeader.js +0 -11
- package/dist/core/fetcher/getRequestBody.d.ts +0 -7
- package/dist/core/fetcher/getRequestBody.js +0 -23
- package/dist/core/fetcher/getResponseBody.d.ts +0 -1
- package/dist/core/fetcher/getResponseBody.js +0 -54
- package/dist/core/fetcher/index.d.ts +0 -5
- package/dist/core/fetcher/index.js +0 -9
- package/dist/core/fetcher/makeRequest.d.ts +0 -1
- package/dist/core/fetcher/makeRequest.js +0 -42
- package/dist/core/fetcher/requestWithRetries.d.ts +0 -1
- package/dist/core/fetcher/requestWithRetries.js +0 -40
- package/dist/core/fetcher/signals.d.ts +0 -11
- package/dist/core/fetcher/signals.js +0 -36
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +0 -60
- package/dist/core/form-data-utils/FormDataWrapper.js +0 -188
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +0 -4
- package/dist/core/form-data-utils/encodeAsFormParameter.js +0 -18
- package/dist/core/form-data-utils/index.d.ts +0 -2
- package/dist/core/form-data-utils/index.js +0 -20
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js +0 -19
- package/dist/core/json.d.ts +0 -15
- package/dist/core/json.js +0 -24
- package/dist/core/runtime/index.d.ts +0 -1
- package/dist/core/runtime/index.js +0 -5
- package/dist/core/runtime/runtime.d.ts +0 -9
- package/dist/core/runtime/runtime.js +0 -103
- package/dist/environments.d.ts +0 -8
- package/dist/environments.js +0 -10
- package/dist/errors/SarvamError.d.ts +0 -12
- package/dist/errors/SarvamError.js +0 -33
- package/dist/errors/SarvamTimeoutError.d.ts +0 -6
- package/dist/errors/SarvamTimeoutError.js +0 -13
- package/dist/errors/index.d.ts +0 -2
- package/dist/errors/index.js +0 -7
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -44
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -4
- package/environments.d.ts +0 -8
- package/environments.js +0 -10
- package/errors/SarvamError.d.ts +0 -12
- package/errors/SarvamError.js +0 -33
- package/errors/SarvamTimeoutError.d.ts +0 -6
- package/errors/SarvamTimeoutError.js +0 -13
- package/errors/index.d.ts +0 -2
- package/errors/index.js +0 -7
- package/index.d.ts +0 -4
- package/index.js +0 -44
- package/jest.config.mjs +0 -8
- package/reference.md +0 -768
- package/scripts/rename-to-esm-files.js +0 -115
- package/version.d.ts +0 -1
- package/version.js +0 -4
|
@@ -1,314 +0,0 @@
|
|
|
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.Text = 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 Text {
|
|
58
|
-
constructor(_options = {}) {
|
|
59
|
-
this._options = _options;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* **Translation** converts text from one language to another while preserving its meaning.
|
|
63
|
-
* 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.
|
|
64
|
-
*
|
|
65
|
-
* Available languages:
|
|
66
|
-
* - **`en-IN`**: English
|
|
67
|
-
* - **`hi-IN`**: Hindi
|
|
68
|
-
* - **`bn-IN`**: Bengali
|
|
69
|
-
* - **`gu-IN`**: Gujarati
|
|
70
|
-
* - **`kn-IN`**: Kannada
|
|
71
|
-
* - **`ml-IN`**: Malayalam
|
|
72
|
-
* - **`mr-IN`**: Marathi
|
|
73
|
-
* - **`od-IN`**: Odia
|
|
74
|
-
* - **`pa-IN`**: Punjabi
|
|
75
|
-
* - **`ta-IN`**: Tamil
|
|
76
|
-
* - **`te-IN`**: Telugu
|
|
77
|
-
*
|
|
78
|
-
* 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).
|
|
79
|
-
*
|
|
80
|
-
* @param {Sarvam.TranslationRequest} request
|
|
81
|
-
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
82
|
-
*
|
|
83
|
-
* @throws {@link Sarvam.BadRequestError}
|
|
84
|
-
* @throws {@link Sarvam.ForbiddenError}
|
|
85
|
-
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
86
|
-
* @throws {@link Sarvam.TooManyRequestsError}
|
|
87
|
-
* @throws {@link Sarvam.InternalServerError}
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* await client.text.translate({
|
|
91
|
-
* input: "input",
|
|
92
|
-
* source_language_code: "auto",
|
|
93
|
-
* target_language_code: "en-IN"
|
|
94
|
-
* })
|
|
95
|
-
*/
|
|
96
|
-
translate(request, requestOptions) {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
const _response = yield core.fetcher({
|
|
100
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamEnvironment.Production, "translate"),
|
|
101
|
-
method: "POST",
|
|
102
|
-
headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
103
|
-
? yield core.Supplier.get(this._options.apiSubscriptionKey)
|
|
104
|
-
: 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 }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
105
|
-
contentType: "application/json",
|
|
106
|
-
requestType: "json",
|
|
107
|
-
body: request,
|
|
108
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
109
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
110
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
111
|
-
});
|
|
112
|
-
if (_response.ok) {
|
|
113
|
-
return _response.body;
|
|
114
|
-
}
|
|
115
|
-
if (_response.error.reason === "status-code") {
|
|
116
|
-
switch (_response.error.statusCode) {
|
|
117
|
-
case 400:
|
|
118
|
-
throw new Sarvam.BadRequestError(_response.error.body);
|
|
119
|
-
case 403:
|
|
120
|
-
throw new Sarvam.ForbiddenError(_response.error.body);
|
|
121
|
-
case 422:
|
|
122
|
-
throw new Sarvam.UnprocessableEntityError(_response.error.body);
|
|
123
|
-
case 429:
|
|
124
|
-
throw new Sarvam.TooManyRequestsError(_response.error.body);
|
|
125
|
-
case 500:
|
|
126
|
-
throw new Sarvam.InternalServerError(_response.error.body);
|
|
127
|
-
default:
|
|
128
|
-
throw new errors.SarvamError({
|
|
129
|
-
statusCode: _response.error.statusCode,
|
|
130
|
-
body: _response.error.body,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
switch (_response.error.reason) {
|
|
135
|
-
case "non-json":
|
|
136
|
-
throw new errors.SarvamError({
|
|
137
|
-
statusCode: _response.error.statusCode,
|
|
138
|
-
body: _response.error.rawBody,
|
|
139
|
-
});
|
|
140
|
-
case "timeout":
|
|
141
|
-
throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /translate.");
|
|
142
|
-
case "unknown":
|
|
143
|
-
throw new errors.SarvamError({
|
|
144
|
-
message: _response.error.errorMessage,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
|
|
151
|
-
*
|
|
152
|
-
* @param {Sarvam.LanguageIdentificationRequest} request
|
|
153
|
-
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
154
|
-
*
|
|
155
|
-
* @throws {@link Sarvam.BadRequestError}
|
|
156
|
-
* @throws {@link Sarvam.ForbiddenError}
|
|
157
|
-
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
158
|
-
* @throws {@link Sarvam.TooManyRequestsError}
|
|
159
|
-
* @throws {@link Sarvam.InternalServerError}
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* await client.text.identifyLanguage({
|
|
163
|
-
* input: "input"
|
|
164
|
-
* })
|
|
165
|
-
*/
|
|
166
|
-
identifyLanguage(request, requestOptions) {
|
|
167
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
const _response = yield core.fetcher({
|
|
170
|
-
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, "text-lid"),
|
|
171
|
-
method: "POST",
|
|
172
|
-
headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
173
|
-
? yield core.Supplier.get(this._options.apiSubscriptionKey)
|
|
174
|
-
: 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 }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
175
|
-
contentType: "application/json",
|
|
176
|
-
requestType: "json",
|
|
177
|
-
body: request,
|
|
178
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
179
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
180
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
181
|
-
});
|
|
182
|
-
if (_response.ok) {
|
|
183
|
-
return _response.body;
|
|
184
|
-
}
|
|
185
|
-
if (_response.error.reason === "status-code") {
|
|
186
|
-
switch (_response.error.statusCode) {
|
|
187
|
-
case 400:
|
|
188
|
-
throw new Sarvam.BadRequestError(_response.error.body);
|
|
189
|
-
case 403:
|
|
190
|
-
throw new Sarvam.ForbiddenError(_response.error.body);
|
|
191
|
-
case 422:
|
|
192
|
-
throw new Sarvam.UnprocessableEntityError(_response.error.body);
|
|
193
|
-
case 429:
|
|
194
|
-
throw new Sarvam.TooManyRequestsError(_response.error.body);
|
|
195
|
-
case 500:
|
|
196
|
-
throw new Sarvam.InternalServerError(_response.error.body);
|
|
197
|
-
default:
|
|
198
|
-
throw new errors.SarvamError({
|
|
199
|
-
statusCode: _response.error.statusCode,
|
|
200
|
-
body: _response.error.body,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
switch (_response.error.reason) {
|
|
205
|
-
case "non-json":
|
|
206
|
-
throw new errors.SarvamError({
|
|
207
|
-
statusCode: _response.error.statusCode,
|
|
208
|
-
body: _response.error.rawBody,
|
|
209
|
-
});
|
|
210
|
-
case "timeout":
|
|
211
|
-
throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /text-lid.");
|
|
212
|
-
case "unknown":
|
|
213
|
-
throw new errors.SarvamError({
|
|
214
|
-
message: _response.error.errorMessage,
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* **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.
|
|
221
|
-
*
|
|
222
|
-
* 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.
|
|
223
|
-
*
|
|
224
|
-
* **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.
|
|
225
|
-
* ### Examples of **Transliteration**:
|
|
226
|
-
* - **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
|
|
227
|
-
* - **'सुप्रभात'** becomes **'suprabhat'** in English.
|
|
228
|
-
*
|
|
229
|
-
* Available languages:
|
|
230
|
-
* - **`en-IN`**: English
|
|
231
|
-
* - **`hi-IN`**: Hindi
|
|
232
|
-
* - **`bn-IN`**: Bengali
|
|
233
|
-
* - **`gu-IN`**: Gujarati
|
|
234
|
-
* - **`kn-IN`**: Kannada
|
|
235
|
-
* - **`ml-IN`**: Malayalam
|
|
236
|
-
* - **`mr-IN`**: Marathi
|
|
237
|
-
* - **`od-IN`**: Odia
|
|
238
|
-
* - **`pa-IN`**: Punjabi
|
|
239
|
-
* - **`ta-IN`**: Tamil
|
|
240
|
-
* - **`te-IN`**: Telugu
|
|
241
|
-
*
|
|
242
|
-
* 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).
|
|
243
|
-
*
|
|
244
|
-
* @param {Sarvam.TransliterationRequest} request
|
|
245
|
-
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
|
|
246
|
-
*
|
|
247
|
-
* @throws {@link Sarvam.BadRequestError}
|
|
248
|
-
* @throws {@link Sarvam.ForbiddenError}
|
|
249
|
-
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
250
|
-
* @throws {@link Sarvam.TooManyRequestsError}
|
|
251
|
-
* @throws {@link Sarvam.InternalServerError}
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* await client.text.transliterate({
|
|
255
|
-
* input: "input",
|
|
256
|
-
* source_language_code: "auto",
|
|
257
|
-
* target_language_code: "en-IN"
|
|
258
|
-
* })
|
|
259
|
-
*/
|
|
260
|
-
transliterate(request, requestOptions) {
|
|
261
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
-
var _a, _b;
|
|
263
|
-
const _response = yield core.fetcher({
|
|
264
|
-
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, "transliterate"),
|
|
265
|
-
method: "POST",
|
|
266
|
-
headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
267
|
-
? yield core.Supplier.get(this._options.apiSubscriptionKey)
|
|
268
|
-
: 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 }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
269
|
-
contentType: "application/json",
|
|
270
|
-
requestType: "json",
|
|
271
|
-
body: request,
|
|
272
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
273
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
274
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
275
|
-
});
|
|
276
|
-
if (_response.ok) {
|
|
277
|
-
return _response.body;
|
|
278
|
-
}
|
|
279
|
-
if (_response.error.reason === "status-code") {
|
|
280
|
-
switch (_response.error.statusCode) {
|
|
281
|
-
case 400:
|
|
282
|
-
throw new Sarvam.BadRequestError(_response.error.body);
|
|
283
|
-
case 403:
|
|
284
|
-
throw new Sarvam.ForbiddenError(_response.error.body);
|
|
285
|
-
case 422:
|
|
286
|
-
throw new Sarvam.UnprocessableEntityError(_response.error.body);
|
|
287
|
-
case 429:
|
|
288
|
-
throw new Sarvam.TooManyRequestsError(_response.error.body);
|
|
289
|
-
case 500:
|
|
290
|
-
throw new Sarvam.InternalServerError(_response.error.body);
|
|
291
|
-
default:
|
|
292
|
-
throw new errors.SarvamError({
|
|
293
|
-
statusCode: _response.error.statusCode,
|
|
294
|
-
body: _response.error.body,
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
switch (_response.error.reason) {
|
|
299
|
-
case "non-json":
|
|
300
|
-
throw new errors.SarvamError({
|
|
301
|
-
statusCode: _response.error.statusCode,
|
|
302
|
-
body: _response.error.rawBody,
|
|
303
|
-
});
|
|
304
|
-
case "timeout":
|
|
305
|
-
throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /transliterate.");
|
|
306
|
-
case "unknown":
|
|
307
|
-
throw new errors.SarvamError({
|
|
308
|
-
message: _response.error.errorMessage,
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
exports.Text = Text;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./requests";
|
|
@@ -1,17 +0,0 @@
|
|
|
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);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* @example
|
|
6
|
-
* {
|
|
7
|
-
* input: "input"
|
|
8
|
-
* }
|
|
9
|
-
*/
|
|
10
|
-
export interface LanguageIdentificationRequest {
|
|
11
|
-
/** The text input for language and script identification. */
|
|
12
|
-
input: string;
|
|
13
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
* input: "input",
|
|
9
|
-
* source_language_code: "auto",
|
|
10
|
-
* target_language_code: "en-IN"
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
export interface TranslationRequest {
|
|
14
|
-
/** The text you want to translate. This is the input text that will be processed by the translation model. */
|
|
15
|
-
input: string;
|
|
16
|
-
/**
|
|
17
|
-
* The language code of the input text. This specifies the source language for translation.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic translation.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
source_language_code: Sarvam.TranslateSourceLanguage;
|
|
25
|
-
/**
|
|
26
|
-
* The language code of the translated text. This specifies the target language for translation.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic translation.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
target_language_code: Sarvam.TranslateTargetLanguage;
|
|
34
|
-
/** Please specify the gender of the speaker for better translations. This feature is only supported for the code-mixed translation models currently. */
|
|
35
|
-
speaker_gender?: Sarvam.TranslateSpeakerGender;
|
|
36
|
-
/** Specifies the tone or style of the translation. Choose between formal, classic-colloquial and modern-colloquial translations. Default is formal. */
|
|
37
|
-
mode?: Sarvam.TranslateMode;
|
|
38
|
-
/** Specifies the translation model to use. Currently, only one model is supported.Note:- This parameter is optional but will be deprecated by the end of January; avoid including it in your requests. */
|
|
39
|
-
model?: Sarvam.TranslateModel;
|
|
40
|
-
/** This will enable custom preprocessing of the input text which can result in better translations. */
|
|
41
|
-
enable_preprocessing?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* **output_script**: This is an optional parameter which controls the transliteration style applied to the output text.
|
|
44
|
-
*
|
|
45
|
-
* **Transliteration**: Converting text from one script to another while preserving pronunciation.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* We support transliteration with four options:
|
|
50
|
-
*
|
|
51
|
-
* - **`null`**(default): No transliteration applied.
|
|
52
|
-
*
|
|
53
|
-
* - **`roman`**: Transliteration in Romanized script.
|
|
54
|
-
* - **`fully-native`**: Transliteration in the native script with formal style.
|
|
55
|
-
* - **`spoken-form-in-native`**: Transliteration in the native script with spoken style.
|
|
56
|
-
* ### Example:
|
|
57
|
-
* English: Your EMI of Rs. 3000 is pending.
|
|
58
|
-
* Default modern translation: आपका Rs. 3000 का EMI pending है (when `null` is passed).
|
|
59
|
-
*
|
|
60
|
-
* With postprocessing enabled, we provide the following style of outputs:
|
|
61
|
-
* - **roman output**: aapka Rs. 3000 ka EMI pending hai.
|
|
62
|
-
* - **fully-native output**: आपका रु. 3000 का ई.एम.ऐ. पेंडिंग है।
|
|
63
|
-
* - **spoken-form-in-native output**: आपका थ्री थाउजेंड रूपीस का ईएमअइ पेंडिंग है।
|
|
64
|
-
*/
|
|
65
|
-
output_script?: Sarvam.TranslatePostprocessing;
|
|
66
|
-
/**
|
|
67
|
-
* `numerals_format` is an optional parameter with two options:
|
|
68
|
-
*
|
|
69
|
-
* - **`international`** (default): Uses regular numerals (0-9).
|
|
70
|
-
* - **`native`**: Uses language-specific native numerals.
|
|
71
|
-
*
|
|
72
|
-
* ### Example:
|
|
73
|
-
* - If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
74
|
-
* - If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
|
|
75
|
-
*/
|
|
76
|
-
numerals_format?: Sarvam.NumeralsFormat;
|
|
77
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
* input: "input",
|
|
9
|
-
* source_language_code: "auto",
|
|
10
|
-
* target_language_code: "en-IN"
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
export interface TransliterationRequest {
|
|
14
|
-
/** The text you want to transliterate. */
|
|
15
|
-
input: string;
|
|
16
|
-
/**
|
|
17
|
-
* The language code of the input text. This specifies the source language for transliteration.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
source_language_code: Sarvam.TransliterateSourceLanguage;
|
|
25
|
-
/**
|
|
26
|
-
* The language code of the transliteration text. This specifies the target language for transliteration.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
target_language_code: Sarvam.TranslatiterateTargetLanguage;
|
|
34
|
-
/**
|
|
35
|
-
* `numerals_format` is an optional parameter with two options:
|
|
36
|
-
*
|
|
37
|
-
* - **`international`** (default): Uses regular numerals (0-9).
|
|
38
|
-
* - **`native`**: Uses language-specific native numerals.
|
|
39
|
-
*
|
|
40
|
-
* ### Example:
|
|
41
|
-
* - If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
42
|
-
* - If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
|
|
43
|
-
*/
|
|
44
|
-
numerals_format?: Sarvam.NumeralsFormat;
|
|
45
|
-
/**
|
|
46
|
-
* `spoken_form_numerals_language` is an optional parameter with two options and only works when spoken_form is true:
|
|
47
|
-
*
|
|
48
|
-
* - **`english`** : Numbers in the text will be spoken in English.
|
|
49
|
-
* - **`native(default)`**: Numbers in the text will be spoken in the native language.
|
|
50
|
-
*
|
|
51
|
-
* ### Examples:
|
|
52
|
-
* - **Input:** "मेरे पास ₹200 है"
|
|
53
|
-
* - If `english` format is selected: "मेरे पास टू हन्डर्ड रूपीस है"
|
|
54
|
-
* - If `native` format is selected: "मेरे पास दो सौ रुपये है"
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
spoken_form_numerals_language?: Sarvam.SpokenFormNumeralsFormat;
|
|
58
|
-
/**
|
|
59
|
-
* - Default: `False`
|
|
60
|
-
* - Converts text into a natural spoken form when `True`.
|
|
61
|
-
* - **Note:** No effect if output language is `en-IN`.
|
|
62
|
-
*
|
|
63
|
-
* ### Example:
|
|
64
|
-
* - **Input:** `मुझे कल 9:30am को appointment है`
|
|
65
|
-
* - **Output:** `मुझे कल सुबह साढ़े नौ बजे को अपॉइंटमेंट है`
|
|
66
|
-
*/
|
|
67
|
-
spoken_form?: boolean;
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client";
|
|
@@ -1,17 +0,0 @@
|
|
|
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);
|
|
@@ -1,51 +0,0 @@
|
|
|
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 TextToSpeech {
|
|
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 TextToSpeech {
|
|
29
|
-
protected readonly _options: TextToSpeech.Options;
|
|
30
|
-
constructor(_options?: TextToSpeech.Options);
|
|
31
|
-
/**
|
|
32
|
-
* This is the model to convert text into spoken audio.
|
|
33
|
-
* The output is a wave file encoded as a base64 string.
|
|
34
|
-
*
|
|
35
|
-
* @param {Sarvam.TextToSpeechRequest} request
|
|
36
|
-
* @param {TextToSpeech.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
-
*
|
|
38
|
-
* @throws {@link Sarvam.BadRequestError}
|
|
39
|
-
* @throws {@link Sarvam.ForbiddenError}
|
|
40
|
-
* @throws {@link Sarvam.UnprocessableEntityError}
|
|
41
|
-
* @throws {@link Sarvam.TooManyRequestsError}
|
|
42
|
-
* @throws {@link Sarvam.InternalServerError}
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* await client.textToSpeech.convert({
|
|
46
|
-
* inputs: ["inputs"],
|
|
47
|
-
* target_language_code: "hi-IN"
|
|
48
|
-
* })
|
|
49
|
-
*/
|
|
50
|
-
convert(request: Sarvam.TextToSpeechRequest, requestOptions?: TextToSpeech.RequestOptions): Promise<Sarvam.TextToSpeechResponse>;
|
|
51
|
-
}
|