Bhashini APIs
  • Overall Understanding of the API Calls
  • Pre-requisites and Onboarding
  • Pipeline Search Call
  • Pipeline Config Call
    • Request Payload
    • Response Payload
  • Pipeline Compute Call
    • Request Payload
    • Response Payload
  • Download Postman Collection
  • Appendix
Powered by GitBook
On this page
  • Request Payload for Individual Task
  • Request Payload for Combination of Tasks in specific sequence
  1. Pipeline Compute Call

Request Payload

This sub-page helps the integrator to understand various different types of request payload based on the individual task or combination of tasks in that sequence that integrator wants to do.

Request Payload for Individual Task

{
    "pipelineTasks": [
        {
            "taskType": "asr",
            "config": {
                "language": {
                    "sourceLanguage": "xx"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd",
                "audioFormat": "wav",
                "samplingRate": 16000
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": null
            }
        ],
        "audio": [
            {
                "audioContent": "{{generated_base64_content}}"
            }
        ]
    }
}

This response contains 2 major parameters listed below and detailed further down the section:

  1. pipelineTasks

  2. inputData

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes only one dictionary (line 3-13) because integrator wants to do only ASR. taskType parameter takes String that takes the value asr

config parameter takes a Dictionary that contains following parameters:

audioFormat parameter accepts format of the audio which was recorded by the application.

  • For Android, wav is preferred and

  • For iOS, wav or flac is preferred.

However, the Server also accepts other well -known formats such as mp3.

Sampling Rate is determined by the application at which the audio is recorded. The Server accepts a minimum value of 8000 for samplingRate parameter.

Parameters other than taskType, serviceId and config are optional.

Parameter: inputData

inputData Parameter takes the actual input from the integrator on which the individual task has to be done. It can take the input either via input parameter or audio parameter depending on the task to be done. Since ASR is done on audio input data, for ASR,

  • input parameter is optional, of no use for ASR but

  • audio parameter is mandatory.

audio parameter takes audioContent parameter which accepts base64 String of the actual audio captured.

If audioFormat or/and samplingRate parameter is/are sent, integrator should make sure that these values correspond to the actual recorded audio.

{
    "pipelineTasks": [
        {
            "taskType": "translation",
            "config": {
                "language": {
                    "sourceLanguage": "hi",
                    "targetLanguage": "xx"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd"
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": "मेरा नाम विहिर है और मैं भाषाावर्ष यूज कर रहा हूँ"
            }
        ],
        "audio": [
            {
                "audioContent": null
            }
        ]
    }
}

This response contains 2 major parameters listed below and detailed further down the section:

  1. pipelineTasks

  2. inputData

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes only one dictionary (line 3-12) because integrator wants to do only Translation. taskType parameter takes String that takes the value translation

config parameter takes a Dictionary that contains following parameters:

Parameter: inputData

inputData Parameter takes the actual input from the integrator on which the individual task has to be done. It can take the input either via input parameter or audio parameter depending on the task to be done. Since Transaltion is done on digital text input data, for Translation,

  • input parameter is mandatory and

  • audio parameter is optional and of no use for Translation.

input parameter takes source parameter which accepts digital text string.

{
    "pipelineTasks": [       
        {
            "taskType": "tts",
            "config": {
                "language": {
                    "sourceLanguage": "gu"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd",
                "gender": "female"
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": "મારું નામ વિહીર છે અને હું ભાષાવર્ષનો ઉપયોગ કરી રહ્યો છું"
            }
        ],
        "audio": [
            {
                "audioContent": null
            }
        ]
    }
}

This response contains 2 major parameters listed below and detailed further down the section:

  1. pipelineTasks

  2. inputData

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes only one dictionary (line 3-12) because integrator wants to do only TTS. taskType parameter takes String that takes the value tts

config parameter takes a Dictionary that contains following parameters:

gender parameter takes a string input which can either be:

  • male

  • female

gender parameter tells the server that integrator is requesting the generated speech in either male or female voice.

Parameter: inputData

inputData Parameter takes the actual input from the integrator on which the individual task has to be done. It can take the input either via input parameter or audio parameter depending on the task to be done. Since TTS is done on digital text input data, for TTS,

  • input parameter is mandatory and

  • audio parameter is optional and of no use for TTS.

input parameter takes source parameter which accepts digital text string.

Request Payload for Combination of Tasks in specific sequence

{
    "pipelineTasks": [
        {
            "taskType": "asr",
            "config": {
                "language": {
                    "sourceLanguage": "xx"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd",
                "audioFormat": "flac",
                "samplingRate": 16000
            }
        },
        {
            "taskType": "translation",
            "config": {
                "language": {
                    "sourceLanguage": "xx",
                    "targetLanguage": "yy"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--mfkds"
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": null
            }
        ],
        "audio": [
            {
                "audioContent": "{{generated_base64_content}}"
            }
        ]
    }
}

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes two dictionaries:

  • Line 3 to 13 i.e., ASR Dictionary

  • Line 14 to 23 i.e., Translation Dictionary

because integrator wants to do ASR of the input voice followed by Translation of the digital text.

Line Number 7 and Line Number 18 are connected with below understanding. Consider a use-case described below:

Integrator wants to speak in say Hindi language and wants to see the translated output in Marathi. For this to happen, integrator has to:

  • Convert the Audio integrator has spoken to digital text i.e., ASR of Hindi

  • Translate this digital Hindi text to Marathi digital text i.e., Translation from Hindi to Marathi

{
    "pipelineTasks": [
        {
            "taskType": "translation",
            "config": {
                "language": {
                    "sourceLanguage": "hi",
                    "targetLanguage": "yy"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd"
            }
        },
        {
            "taskType": "tts",
            "config": {
                "language": {
                    "sourceLanguage": "yy"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--csdcxsa",
                "gender": "female"
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": "मेरा नाम विहिर है और मैं भाषाावर्ष यूज कर रहा हूँ"
            }
        ],
        "audio": [
            {
                "audioContent": null
            }
        ]
    }
}

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes two dictionaries:

  • Line 3 to 12 i.e., Translation Dictionary

  • Line 13 to 22 i.e., TTS Dictionary

because integrator wants to do Translation of a digital text followed by TTS.

Line Number 8 and Line Number 17 are connected with below understanding. Consider a use-case described below:

Integrator wants to translate say from Hindi to Marathi language and wants to hear the output in Marathi. For this to happen, integrator has to:

  • Translate this digital Hindi text to Marathi digital text i.e., Translation from Hindi to Marathi

  • Generate this Marathi text speech i.e., TTS of the Marathi digital text.

Speech shall be generated in Marathi which means the language code to be inserted in Line 17 shall be mr, same as Line 8.

{
    "pipelineTasks": [
        {
            "taskType": "asr",
            "config": {
                "language": {
                    "sourceLanguage": "xx"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--dddd",
                "audioFormat": "flac",
                "samplingRate": 16000
            }
        },
        {
            "taskType": "translation",
            "config": {
                "language": {
                    "sourceLanguage": "xx",
                    "targetLanguage": "yy"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--fwsd"
            }
        },
        {
            "taskType": "tts",
            "config": {
                "language": {
                    "sourceLanguage": "yy"
                },
                "serviceId": "xxxxx--ssssss-d-ddd--fvdfg",
                "gender": "female"
            }
        }
    ],
    "inputData": {
        "input": [
            {
                "source": null
            }
        ],
        "audio": [
            {
                "audioContent": "{{generated_base64_content}}"
            }
        ]
    }
}

Parameter: pipelineTasks

Type: Array This parameter takes an array of tasks, in the form of dictionary of taskType and config, that are to be done by the integrator. In the above example, pipelineTasks takes two dictionaries:

  • Line 3 to 13 i.e., ASR Dictionary

  • Line 14 to 23 i.e., Translation Dictionary

  • Line 24 to 33 i.e., TTS Dictionary

because integrator wants to do ASR of the voice input, then Translation of a digital text followed by TTS.

Line Number 7 and Line Number 18 are connected and Line Number 19 and Line Number 28 with below understanding. Consider a use-case described below:

Integrator wants to speak in say Hindi language and wants to hear the translated output in Marathi. For this to happen, integrator has to:

  • Convert the Audio integrator has spoken to digital text i.e., ASR of Hindi

  • Translate this digital Hindi text to Marathi digital text i.e., Translation from Hindi to Marathi

  • Generate this Marathi text speech i.e., TTS of the Marathi digital text.

Speech shall be generated in Marathi which means the language code to be inserted in Line 28 shall be mr, same as Line 19.

PreviousPipeline Compute CallNextResponse Payload

Last updated 2 years ago

For ASR, language parameter only takes sourceLanguage which accepts of the language.

serviceId parameter is obtained from the Pipeline Config Call as described .

For Translation, language parameter takes both sourceLanguage and targetLanguage which accepts of the language.

serviceId parameter is obtained from the Pipeline Config Call as described .

For TTS, language parameter only takes sourceLanguage which accepts of the language.

serviceId parameter is obtained from the Pipeline Config Call as described .

Therefore, the language code for ASR that is to be inserted in Line 7, shall be hi, i.e., code for Hindi. Once this Hindi digital text is generated, the same shall be translated to Marathi, therefore the source language code for Translation that is to be inserted in Line 18, shall also be hi, which means that language code in Line 7 and Line 18 shall be same.

For Target Language the code to be inserted in Line 19 shall be mr, i.e., code for Marathi.

Understanding of all other parameters remains same as described above in .

Therefore, the source language code for Translation that is to be inserted in Line 7, shall be hi, i.e., code for Hindi. The target language code to be inserted in Line 8 shall be mr, i.e., code for Marathi.

Understanding of all other parameters remains same as described above in .

Therefore, the language code for ASR that is to be inserted in Line 7, shall be hi, i.e., code for Hindi. Once this Hindi digital text is generated, the same shall be translated to Marathi, therefore the source language code for Translation that is to be inserted in Line 18, shall also be hi, which means that language code in Line 7 and Line 18 shall be same.

The target language code to be inserted in Line 19 shall be mr, i.e., code for Marathi.

Understanding of all other parameters remains same as described above in .

ISO-639 Series Code
ISO-639 Series Code
ISO-639 Series Code
ISO 639 series
ISO 639 series
Request Payload for Individual Task
ISO 639 series
ISO 639 series
Request Payload for Individual Task
ISO 639 series
ISO 639 series
Request Payload for Individual Task
response
response
response
here
here
here