How to pick a genre

View as Markdown

genre tunes the translation prompt for the kind of content you’re translating — vocabulary, tone, and terminology.

ParameterTypeValuesDefault
genrestringNON_FICTION, ADULT_FICTION, CHILDREN_FICTION, RELIGIOUS, LEGAL, ACADEMIC-

Pick the genre that best matches your document type. LEGAL for contracts, CHILDREN_FICTION for children’s books, ACADEMIC for research papers.

Example

from sarvamai import SarvamAI
client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")
job = client.document_translation.create(
job_name="service-agreement-hi",
source_language_code="en-IN",
target_language_codes=["hi-IN"],
original_filename="service-agreement.pdf",
genre="LEGAL",
)

Request body equivalent:

{
"job_name": "service-agreement-hi",
"source_language_code": "en-IN",
"target_language_codes": ["hi-IN"],
"original_filename": "service-agreement.pdf",
"genre": "LEGAL"
}