Combined Pipelines

With Bhashini's Dhruva inference engine, you don't need to make multiple network hops to build speech-to-speech translation systems. You can chain Automatic Speech Recognition (ASR), Neural Machine Translation (NMT), and Text-to-Speech (TTS) into a single HTTP request.

The pipeline orchestrator automatically feeds the output of each preceding task into the next:

[User Audio (Hindi)] 
       │
       ▼
 ┌───────────┐
 │ 1. ASR    │ ──> Produces Hindi Transcript: "आप कैसे हैं?"
 └───────────┘
       │
       ▼
 ┌───────────┐
 │ 2. NMT    │ ──> Translates to Tamil: "நீங்கள் எப்படி இருக்கிறீர்கள்?"
 └───────────┘
       │
       ▼
 ┌───────────┐
 │ 3. TTS    │ ──> Synthesizes Tamil Spoken Audio (Base64 WAV)
 └───────────┘
       │
       ▼
[Response containing Transcript, Translation, and Audio]

Single-Request Chained Pipeline Payload

Send all tasks together in the pipelineTasks array. Notice how the input audio is provided under inputData.audio, and Dhruva automatically routes intermediate outputs between stages:

{
  "pipelineTasks": [
    {
      "taskType": "asr",
      "config": {
        "language": { "sourceLanguage": "hi" },
        "serviceId": "<ASR_SERVICE_ID>"
      }
    },
    {
      "taskType": "translation",
      "config": {
        "language": {
          "sourceLanguage": "hi",
          "targetLanguage": "ta"
        },
        "serviceId": "<TRANSLATION_SERVICE_ID>"
      }
    },
    {
      "taskType": "tts",
      "config": {
        "language": { "sourceLanguage": "ta" },
        "serviceId": "<TTS_SERVICE_ID>",
        "gender": "female"
      }
    }
  ],
  "inputData": {
    "audio": [
      {
        "audioContent": "<BASE64_ENCODED_HINDI_AUDIO>"
      }
    ]
  }
}

Pipeline Response Structure

Dhruva returns a consolidated array in pipelineResponse with the artifacts of every stage in order:

{
  "pipelineResponse": [
    {
      "taskType": "asr",
      "output": [
        {
          "source": "आप कैसे हैं?"
        }
      ]
    },
    {
      "taskType": "translation",
      "output": [
        {
          "source": "आप कैसे हैं?",
          "target": "நீங்கள் எப்படி இருக்கிறீர்கள்?"
        }
      ]
    },
    {
      "taskType": "tts",
      "audio": [
        {
          "audioContent": "UklGRi4AAABXQVZFZm10IBAAAAABAAEA...",
          "audioUri": null
        }
      ]
    }
  ]
}

Code Examples

import fs from 'fs';


const url = 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline';
const audioBase64 = fs.readFileSync('hindi_input.wav').toString('base64');


const payload = {
  pipelineTasks: [
    {
      taskType: 'asr',
      config: {
        language: { sourceLanguage: 'hi' },
        serviceId: '<ASR_SERVICE_ID>'
      }
    },
    {
      taskType: 'translation',
      config: {
        language: { sourceLanguage: 'hi', targetLanguage: 'ta' },
        serviceId: '<TRANSLATION_SERVICE_ID>'
      }
    },
    {
      taskType: 'tts',
      config: {
        language: { sourceLanguage: 'ta' },
        serviceId: '<TTS_SERVICE_ID>',
        gender: 'female'
      }
    }
  ],
  inputData: {
    audio: [{ audioContent: audioBase64 }]
  }
};


const res = await fetch(url, {
  method: 'POST',
  headers: {
    'Authorization': '<YOUR_INFERENCE_API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
});


const data = await res.json();
console.log('ASR Output:', data.pipelineResponse[0].output[0].source);
console.log('Translation Output:', data.pipelineResponse[1].output[0].target);


// Save generated audio
const outputAudioB64 = data.pipelineResponse[2].audio[0].audioContent;
fs.writeFileSync('tamil_output.wav', Buffer.from(outputAudioB64, 'base64'));

Interactive Component Testing

Test each stage of the multimodal chain using the interactive playground modules below:

Step 1: Test Speech Recognition
Transcribe spoken input to text
Request
Choose audio file
audio or video (wav, flac, mp3, m4a, aac, ogg, webm, mp4, mov) · max 120 s
Audio (base64)
Add an inference API key to run.
curl
curl --location 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline' \
--header 'Accept: */*' \
--header 'Authorization: YOUR_INFERENCE_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"pipelineTasks": [
{
"taskType": "asr",
"config": {
"serviceId": "",
"language": {
"sourceLanguage": "hi"
}
}
}
],
"inputData": {
"audio": [
{
"audioContent": "<base64-audio>"
}
]
}
}'
Response
Send a request to see the live response here.