How to set style guidelines

View as Markdown

style_guidelines lets you steer tone, terminology, and formatting for the whole job in free text. language_specific_guidelines layers per-language overrides on top of it.

ParameterTypeNotes
style_guidelinesstringUp to ~4000 characters. Applies to every target language in the job.
language_specific_guidelinesobjectKeys must match entries in target_language_codes. Overrides style_guidelines for that language only.

Use style_guidelines for instructions that should hold across every language, for example “keep product names untranslated.” Use language_specific_guidelines only when one language needs different handling, such as a regional terminology preference.

Example

1from sarvamai import SarvamAI
2
3client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")
4
5job = client.document_translation.create(
6 job_name="employee-handbook-hi-ta",
7 source_language_code="en-IN",
8 target_language_codes=["hi-IN", "ta-IN"],
9 original_filename="employee-handbook.docx",
10 style_guidelines=(
11 "Keep all product names and legal entity names untranslated. "
12 "Use formal register throughout."
13 ),
14 language_specific_guidelines={
15 "ta-IN": "Prefer commonly used loanwords over invented Tamil equivalents for technical terms.",
16 },
17)

Request body equivalent:

1{
2 "job_name": "employee-handbook-hi-ta",
3 "source_language_code": "en-IN",
4 "target_language_codes": ["hi-IN", "ta-IN"],
5 "original_filename": "employee-handbook.docx",
6 "style_guidelines": "Keep all product names and legal entity names untranslated. Use formal register throughout.",
7 "language_specific_guidelines": {
8 "ta-IN": "Prefer commonly used loanwords over invented Tamil equivalents for technical terms."
9 }
10}