# Response Payload

{% tabs %}
{% tab title="Request sent without Configuration Parameters" %}

## Complete Payload

<details>

<summary>Complete Payload</summary>

{% code lineNumbers="true" %}

```json
{
    "languages": [
        {
            "sourceLanguage": "bn",
            "targetLanguageList": [
                "en",
                "as",
                "gu",
                "hi"              
            ]
        },
        {
            "sourceLanguage": "en",
            "targetLanguageList": [               
                "ml",
                "mr",
                "or",
                "pa",
                "ta",
                "te"
            ]
        },       
        {
            "sourceLanguage": "hi",
            "targetLanguageList": [
                "en",
                "as",
                "bn",
                "gu",
                "kn"
            ]
        }
    ],
    "pipelineResponseConfig": [
        {
            "taskType": "asr",
            "config": [
                {
                    "serviceId": "ai4bharat/conformer-multilingual-indo_aryan-gpu--t4",
                    "modelId": "6411746956e9de23f65b5426",
                    "language": {
                        "sourceLanguage": "bn"
                    },
                    "domain": [
                        "general"
                    ]
                },
                {
                    "serviceId": "ai4bharat/conformer-en-gpu--t4",
                    "modelId": "63ee09c3b95268521c70cd7c",
                    "language": {
                        "sourceLanguage": "en"
                    },
                    "domain": [
                        "general"
                    ]
                },
                {
                    "serviceId": "ai4bharat/conformer-multilingual-indo_aryan-gpu--t4",
                    "modelId": "64117455b1463435d2fbaec4",
                    "language": {
                        "sourceLanguage": "hi"
                    },
                    "domain": [
                        "general"
                    ]
                }
            ]
        },
        {
            "taskType": "tts",
            "config": [
                {
                    "serviceId": "ai4bharat/indic-tts-coqui-misc-gpu--t4",
                    "modelId": "63f7384c2ff3ab138f88c64e",
                    "language": {
                        "sourceLanguage": "en"
                    },
                    "supportedVoices": [
                        "male",
                        "female"
                    ]
                },
                {
                    "serviceId": "ai4bharat/indic-tts-coqui-indo_aryan-gpu--t4",
                    "modelId": "6348db0bfd966563f61bc2c0",
                    "language": {
                        "sourceLanguage": "as"
                    },
                    "supportedVoices": [
                        "male",
                        "female"
                    ]
                }
            ]
        },
        {
            "taskType": "translation",
            "config": [
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-i2e-gpu--t4",
                    "modelId": "6110f7bc014fa35d5e767c3b",
                    "language": {
                        "sourceLanguage": "bn",
                        "targetLanguage": "en"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-i2i-gpu--t4",
                    "modelId": "6214b148751fc8007d24084c",
                    "language": {
                        "sourceLanguage": "bn",
                        "targetLanguage": "as"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-e2i-gpu--t4",
                    "modelId": "6110f7ce014fa35d5e767c3c",
                    "language": {
                        "sourceLanguage": "en",
                        "targetLanguage": "as"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-e2i-gpu--t4",
                    "modelId": "6110f7da014fa35d5e767c3d",
                    "language": {
                        "sourceLanguage": "en",
                        "targetLanguage": "bn"
                    }
                }
            ]
        }
    ],
    "pipelineInferenceAPIEndPoint": {
        "callbackUrl": "https://dhruva-api.bhashini.gov.in/services/inference/pipeline",
        "inferenceApiKey": {
            "name": "Authorization",
            "value": "cZVqccgm-LTAzxQVp6jjznmSR5RgKM"
        },
        "isMultilingualEnabled": true,
        "isSyncApi": true
    }
}
```

{% endcode %}

</details>

Complete Payload shows the JSON structure of the content that is received when Integrator makes a ULCA Config Call without any configuration details as detailed in `Tab 1` of [request-payload](https://bhashini.gitbook.io/bhashini-apis/pipeline-config-call/request-payload "mention")\
\
This response contains 3 major parameters listed below and detailed further down the section:

1. [languages](#parameter-languages)
2. [pipelineResponseConfig](#parameter-pipelineresponseconfig)
3. [pipelineInferenceAPIEndPoint](#parameter-pipelineinferenceapiendpoint)

### Parameter: `languages`

This parameter helps integrator to know what languages are available that can be used for the requested pipeline tasks in that sequence.\
\
For example, consider scenarios where Integrator requests for either:

* Individual Task i.e., either ASR or Translation or TTS as shown [here](https://bhashini.gitbook.io/bhashini-apis/request-payload#integrators-want-to-do-individual-tasks)
* Combination of Tasks in that sequence i.e.,
  * ASR+Translation or
  * Translation+TTS or
  * ASR+Translation+TTS as shown [here](https://bhashini.gitbook.io/bhashini-apis/request-payload#integrators-want-to-do-combination-of-tasks-in-that-order)

For Single Tasks, the understanding is straight-forward that the languages appearing in the response corresponds to that task. e.g.&#x20;

* If the integrator wants to do **`only ASR`**, the languages appearing shows that Server can do ASR in these languages. In this case, parameters **`sourceLanguage`** and **`targetLanguageList`** will contain the same value since for ASR involves only one language unlike Translation where source and target (two) languages are involved. In this case, **`targetLanguageList`** can safely be ignored and only **`sourceLanguage`** can be used.&#x20;
* If the integrator wants to do **`only TTS`**, the languages appearing shows that Server can do TTS in these languages. In this case, parameters **`sourceLanguage`** and **`targetLanguageList`** will contain the same value since for TTS too only one language is involved. In this case too, **`targetLanguageList`** can safely be ignored and only **`sourceLanguage`** can be used.

Usual format of language for such cases is below:

<details>

<summary>Supported Languages for requested Pipeline.</summary>

{% code lineNumbers="true" %}

```json
"languages": [
        {
            "sourceLanguage": "bn",
            "targetLanguageList": [
                "bn"              
            ]
        },
        {
            "sourceLanguage": "en",
            "targetLanguageList": [               
                "en"
            ]
        },       
        {
            "sourceLanguage": "hi",
            "targetLanguageList": [
                "hi"
            ]
        }
    ]
```

{% endcode %}

</details>

* If the integrator wants to do **`only Translation`**, the languages appearing shows that Server can do Translation in these languages. In this case, parameters **`sourceLanguage`** and **`targetLanguageList`** means that for the languages appearing in **`targetLanguageList`** are the ones in which Server can do translation FROM the language that appear in **`sourceLanguage`**.

For Combination of Tasks, the understanding is that the languages appearing in the response are the ones which Server can cater to, for the complete task sequence sent by the integrator. e.g.

* If the integrator wants to do **`ASR and Translation`** together in that sequence, the languages appearing shows that the Server can do this combination in that sequence for these languages. In this case, the Server would be able to do this combination for the languages appearing in **`targetLanguageList`**, if the input is given in the language mentioned in **`sourceLanguage`** parameter.
* If the integrator wants to do **`Translation and TTS`** together in that sequence, the languages appearing shows that the Server can do this combination in that sequence for these languages. In this case, the Server would be able to do this combination for the languages appearing in **`targetLanguageList`**, if the input is given in the language mentioned in **`sourceLanguage`** parameter.
* If the integrator wants to do **`ASR, then Translation and then TTS`** together in that sequence, the languages appearing shows that the Server can do this combination in that sequence for these languages. In this case, the Server would be able to do this combination for the languages appearing in **`targetLanguageList`**, if the input is given in the language mentioned in **`sourceLanguage`** parameter.

Usual format of language for such cases is below:

<details>

<summary>Supported Languages for requested Pipeline.</summary>

{% code lineNumbers="true" %}

```json
"languages": [
        {
            "sourceLanguage": "bn",
            "targetLanguageList": [
                "en",
                "as",
                "gu",
                "hi"              
            ]
        },
        {
            "sourceLanguage": "en",
            "targetLanguageList": [               
                "ml",
                "mr",
                "or",
                "pa",
                "ta",
                "te"
            ]
        },       
        {
            "sourceLanguage": "hi",
            "targetLanguageList": [
                "en",
                "as",
                "bn",
                "gu",
                "kn"
            ]
        }
    ]
```

{% endcode %}

</details>

### Parameter: `pipelineResponseConfig`

This parameter helps the integrator to obtain the **`Service ID`** for a particular task type and language(s) associated with that task.

The task types appearing here will be the same as the ones that the integrator requested while sending the **`pipelineTasks`** parameter in [request-payload](https://bhashini.gitbook.io/bhashini-apis/pipeline-config-call/request-payload "mention")\
e.g., Integrator request for configuration of the combination of ASR, Translation and TTS together, the **`pipelineResponseConfig`** parameter in the output will contain the JSON data as shown below. It will contain three dictionaries for each task type ASR, Translation and TTS.\
If Integrator requested for a combination of ASR and Translation, this parameter would contain JSON data for ASR and Translation only.\
\
Now consider, Integrator knows the language for which the combination ASR, Translation and TTS is to be performed (language may be determined by asking the end-user etc.). \
\
Say the language pair chosen is **`Bengali`** to **`Assamese`**.\
\
Integrator shall now obtain the Service ID correspondingly in the below manner:

1. Obtain Service ID for doing **`ASR`** in **`Bengali`**. Line 6 from Dictionary of Line 5-14 below.
2. Obtain Service ID for doing **`Translation`** from **`Bengali`** to **`Assamese`**. Line 49 from Dictionary of Line 48-55 below.
3. Obtain Service ID for doing **`TTS`** in **`Assamese`**. Line 89 from Dictionary of Line 88-98 below.

These Service IDs will be used in the [pipeline-compute-call](https://bhashini.gitbook.io/bhashini-apis/pipeline-compute-call "mention").

{% hint style="info" %}
For each **`taskType`** in the response, there may appear additional configuration parameters that are specific to each **`taskType`**. e.g.,&#x20;

* As seen below, for **`taskType ASR`**, **`domain`** parameter appears which helps integrator to understand the domain(s) (general, agriculture, medical etc.), this particular Service ID is capable of providing output for.
* Similarly, for **`taskType TTS`**, **`supportedVoice`** parameter appears which helps integrator to understand which all voices are available for a particular language that is serviced by that specific Service ID.
  {% endhint %}

<details>

<summary>Configuration Details and Service IDs for requested pipeline tasks.</summary>

{% code lineNumbers="true" %}

```json
"pipelineResponseConfig": [
        {
            "taskType": "asr",
            "config": [
                {
                    "serviceId": "ai4bharat/conformer-multilingual-indo_aryan-gpu--t4",
                    "modelId": "6411746956e9de23f65b5426",
                    "language": {
                        "sourceLanguage": "bn"
                    },
                    "domain": [
                        "general"
                    ]
                },
                {
                    "serviceId": "ai4bharat/conformer-en-gpu--t4",
                    "modelId": "63ee09c3b95268521c70cd7c",
                    "language": {
                        "sourceLanguage": "en"
                    },
                    "domain": [
                        "general"
                    ]
                },
                {
                    "serviceId": "ai4bharat/conformer-multilingual-indo_aryan-gpu--t4",
                    "modelId": "64117455b1463435d2fbaec4",
                    "language": {
                        "sourceLanguage": "hi"
                    },
                    "domain": [
                        "general"
                    ]
                }
            ]
        },
        {
            "taskType": "translation",
            "config": [
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-i2e-gpu--t4",
                    "modelId": "6110f7bc014fa35d5e767c3b",
                    "language": {
                        "sourceLanguage": "bn",
                        "targetLanguage": "en"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-i2i-gpu--t4",
                    "modelId": "6214b148751fc8007d24084c",
                    "language": {
                        "sourceLanguage": "bn",
                        "targetLanguage": "as"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-e2i-gpu--t4",
                    "modelId": "6110f7ce014fa35d5e767c3c",
                    "language": {
                        "sourceLanguage": "en",
                        "targetLanguage": "as"
                    }
                },
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-e2i-gpu--t4",
                    "modelId": "6110f7da014fa35d5e767c3d",
                    "language": {
                        "sourceLanguage": "en",
                        "targetLanguage": "bn"
                    }
                }
            ]
        },
        {
            "taskType": "tts",
            "config": [
                {
                    "serviceId": "ai4bharat/indic-tts-coqui-misc-gpu--t4",
                    "modelId": "63f7384c2ff3ab138f88c64e",
                    "language": {
                        "sourceLanguage": "en"
                    },
                    "supportedVoices": [
                        "male",
                        "female"
                    ]
                },
                {
                    "serviceId": "ai4bharat/indic-tts-coqui-indo_aryan-gpu--t4",
                    "modelId": "6348db0bfd966563f61bc2c0",
                    "language": {
                        "sourceLanguage": "as"
                    },
                    "supportedVoices": [
                        "male",
                        "female"
                    ]
                }
            ]
        }
    ]
```

{% endcode %}

</details>

### Parameter: `pipelineInferenceAPIEndPoint`

This parameter helps the integrator to know the details of the [pipeline-compute-call](https://bhashini.gitbook.io/bhashini-apis/pipeline-compute-call "mention")where to send (**`callbackURL`** parameter) and shall be sent along with the **`Authorization Key-Value pair`** received under **`inferenceApiKey`** parameter which will be used for authentication of the same.

<details>

<summary>Details for Actual Inferencing.</summary>

{% code lineNumbers="true" %}

```json
"pipelineInferenceAPIEndPoint": {
        "callbackUrl": "https://dhruva-api.bhashini.gov.in/services/inference/pipeline",
        "inferenceApiKey": {
            "name": "Authorization",
            "value": "cZVqccgm-LTAzxQVp6jjznmSR5RgKM"
        },
        "isMultilingualEnabled": true,
        "isSyncApi": true
    }
```

{% endcode %}

</details>
{% endtab %}

{% tab title="Request sent with Configuration Parameters" %}

## Complete Payload

<details>

<summary>Complete Payload</summary>

{% code lineNumbers="true" %}

```json
{
    "languages": [
        {
            "sourceLanguage": "gu",
            "targetLanguageList": [
                "bn"
            ]
        }
    ],
    "pipelineResponseConfig": [
        {
            "taskType": "asr",
            "config": [
                {
                    "serviceId": "ai4bharat/conformer-multilingual-indo_aryan-gpu--t4",
                    "modelId": "6411746056e9de23f65b5425",
                    "language": {
                        "sourceLanguage": "gu"
                    },
                    "domain": [
                        "general"
                    ]
                }
            ]
        },
        {
            "taskType": "translation",
            "config": [
                {
                    "serviceId": "ai4bharat/indictrans-fairseq-i2i-gpu--t4",
                    "modelId": "62023eeb3fc51c3fe32b8c5b",
                    "language": {
                        "sourceLanguage": "gu",
                        "targetLanguage": "bn"
                    }
                }
            ]
        },
        {
            "taskType": "tts",
            "config": [
                {
                    "serviceId": "ai4bharat/indic-tts-coqui-indo_aryan-gpu--t4",
                    "modelId": "636e60e586369150cb00432a",
                    "language": {
                        "sourceLanguage": "bn"
                    },
                    "supportedVoices": [
                        "male",
                        "female"
                    ]
                }
            ]
        }
    ],
    "pipelineInferenceAPIEndPoint": {
        "callbackUrl": "https://dhruva-api.bhashini.gov.in/services/inference/pipeline",
        "inferenceApiKey": {
            "name": "Authorization",
            "value": "m-LTAzxQVp6jjznmSR5RgKM"
        },
        "isMultilingualEnabled": true,
        "isSyncApi": true
    }
}
```

{% endcode %}

</details>

Complete Payload shows the JSON structure of the content that is received when Integrator makes a ULCA Config Call with some configuration details as detailed in `Tab 2` of [request-payload](https://bhashini.gitbook.io/bhashini-apis/pipeline-config-call/request-payload "mention"). Here, the integrator has requested to do a combination of tasks ASR, Translation and TTS in that sequence from **`Gujarati`** to **`Bengali`**

### Parameter: `languages`

The understanding of the parameters remains same as in previous tab.\
Since the languages were already known to the integrator before-hand, therefore, the response contains configuration details for those languages only.

{% hint style="info" %}
There may occur a possibility that Integrator wants to do any individual task or combination of tasks in a sequence for the languages that are **`not`** supported by that **`pipeline ID`** in which case the following response will be obtained:\
\
**Response Code: 400 Bad Request**\
**Response Body:**

{% code lineNumbers="true" %}

```json
{
    "code": "400 BAD_REQUEST",
    "message": "Sequence of languages not supported",
    "timestamp": "2023-04-14T06:32:12.133+00:00"
}
```

{% endcode %}

In such cases, it is recommended to send Pipeline Config Request without Configuration as shown in `Tab 1` under [request-payload](https://bhashini.gitbook.io/bhashini-apis/pipeline-config-call/request-payload "mention")\
Using which Integrators will know what all languages are supported by that pipeline ID.
{% endhint %}

### Parameter: `pipelineResponseConfig`

The understanding of the parameters remains same as in previous tab.\
Since the languages were already known to the integrator before-hand, therefore, the response contains configuration details for those languages only.

### Parameter: `pipelineInferenceAPIEndPoint`

The understanding of the parameters remains same as in previous tab.
{% endtab %}
{% endtabs %}
