File: /home/cafsindia/ai_allyindian_com/node_modules/sarvamai/api/resources/text/client/Client.d.ts
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as SarvamAI from "../../../index";
export declare namespace Text {
interface Options {
environment?: core.Supplier<environments.SarvamAIEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
apiSubscriptionKey?: core.Supplier<string>;
}
interface RequestOptions {
/** The maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Additional headers to include in the request. */
headers?: Record<string, string>;
}
}
export declare class Text {
protected readonly _options: Text.Options;
constructor(_options?: Text.Options);
/**
* **Translation** converts text from one language to another while preserving its meaning.
* 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.
*
* Available languages:
* - **`bn-IN`**: Bengali
* - **`en-IN`**: English
* - **`gu-IN`**: Gujarati
* - **`hi-IN`**: Hindi
* - **`kn-IN`**: Kannada
* - **`ml-IN`**: Malayalam
* - **`mr-IN`**: Marathi
* - **`od-IN`**: Odia
* - **`pa-IN`**: Punjabi
* - **`ta-IN`**: Tamil
* - **`te-IN`**: Telugu
*
* ### Newly added languages:
* - **`as-IN`**: Assamese
* - **`brx-IN`**: Bodo
* - **`doi-IN`**: Dogri
* - **`kok-IN`**: Konkani
* - **`ks-IN`**: Kashmiri
* - **`mai-IN`**: Maithili
* - **`mni-IN`**: Manipuri (Meiteilon)
* - **`ne-IN`**: Nepali
* - **`sa-IN`**: Sanskrit
* - **`sat-IN`**: Santali
* - **`sd-IN`**: Sindhi
* - **`ur-IN`**: Urdu
*
* 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).
*
* @param {SarvamAI.TranslationRequest} request
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link SarvamAI.BadRequestError}
* @throws {@link SarvamAI.ForbiddenError}
* @throws {@link SarvamAI.UnprocessableEntityError}
* @throws {@link SarvamAI.TooManyRequestsError}
* @throws {@link SarvamAI.InternalServerError}
*
* @example
* await client.text.translate({
* input: "input",
* source_language_code: "auto",
* target_language_code: "bn-IN"
* })
*/
translate(request: SarvamAI.TranslationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.TranslationResponse>;
/**
* Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
*
* @param {SarvamAI.LanguageIdentificationRequest} request
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link SarvamAI.BadRequestError}
* @throws {@link SarvamAI.ForbiddenError}
* @throws {@link SarvamAI.UnprocessableEntityError}
* @throws {@link SarvamAI.TooManyRequestsError}
* @throws {@link SarvamAI.InternalServerError}
*
* @example
* await client.text.identifyLanguage({
* input: "input"
* })
*/
identifyLanguage(request: SarvamAI.LanguageIdentificationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.LanguageIdentificationResponse>;
/**
* **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.
*
* 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.
*
* **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.
* ### Examples of **Transliteration**:
* - **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
* - **'सुप्रभात'** becomes **'suprabhat'** in English.
*
* Available languages:
* - **`en-IN`**: English
* - **`hi-IN`**: Hindi
* - **`bn-IN`**: Bengali
* - **`gu-IN`**: Gujarati
* - **`kn-IN`**: Kannada
* - **`ml-IN`**: Malayalam
* - **`mr-IN`**: Marathi
* - **`od-IN`**: Odia
* - **`pa-IN`**: Punjabi
* - **`ta-IN`**: Tamil
* - **`te-IN`**: Telugu
*
* 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).
*
* @param {SarvamAI.TransliterationRequest} request
* @param {Text.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link SarvamAI.BadRequestError}
* @throws {@link SarvamAI.ForbiddenError}
* @throws {@link SarvamAI.UnprocessableEntityError}
* @throws {@link SarvamAI.TooManyRequestsError}
* @throws {@link SarvamAI.InternalServerError}
*
* @example
* await client.text.transliterate({
* input: "input",
* source_language_code: "auto",
* target_language_code: "bn-IN"
* })
*/
transliterate(request: SarvamAI.TransliterationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.TransliterationResponse>;
protected _getCustomAuthorizationHeaders(): Promise<{
"api-subscription-key": string | undefined;
}>;
}