How to pick a genre and model tier

View as Markdown

genre tunes the translation prompt for the kind of content you’re translating. model_type trades off speed against quality for the length of content you’re translating.

ParameterTypeValuesDefault
genrestringNON_FICTION, ADULT_FICTION, CHILDREN_FICTION, RELIGIOUS, LEGAL, ACADEMIC-
model_typestringlite (faster, short-form), plus (higher quality, long-form)plus

genre and model_type are independent: pick the genre for tone/terminology and the model tier for the length/quality tradeoff that fits your document.

Example

1from sarvamai import SarvamAI
2
3client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")
4
5job = client.document_translation.create(
6 job_name="service-agreement-hi",
7 source_language_code="en-IN",
8 target_language_codes=["hi-IN"],
9 original_filename="service-agreement.pdf",
10 genre="LEGAL",
11 model_type="plus",
12)

Request body equivalent:

1{
2 "job_name": "service-agreement-hi",
3 "source_language_code": "en-IN",
4 "target_language_codes": ["hi-IN"],
5 "original_filename": "service-agreement.pdf",
6 "genre": "LEGAL",
7 "model_type": "plus"
8}