# Request Payload

{% tabs %}
{% tab title="Without configuration parameters" %}

{% code lineNumbers="true" %}

```json
{
    "pipelineTasks" : [
        {
            "taskType" : "asr"
        },
        {
            "taskType": "translation"
        },
        {  
            "taskType": "tts"
        }
    ],
    "pipelineRequestConfig" : {
        "pipelineId" : "xxxx8d51ae52cxxxxxxxx"
    }
}
```

{% endcode %}

### Parameters

We will now understand about each parameter available as a part of this payload.\
\
**taskType**

**Type:** String

* Line 3-5 for ASR
* Line 6-8 for Translation
* Line 9-11 for TTS

#### pipelineTasks

**Type:** Array\
\
This parameter takes an array of tasks, in the form of dictionary of **`taskType`** as defined above, that are to be done by the integrator. The sequence of tasks matter. In the above example, the configuration that will be returned back in the response will be for tasks ASR, Translation and TTS in that order.\
\
Each `pipelineId` (discussed below), may support few individual or task sequences as explained [here](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) and [here](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) and detailed out below.&#x20;

#### pipelineId

**Type:** String\
\
`pipelineId` takes a string value of the specific pipeline integrator wants to use. The pipeline ID can be obtained either via Pipeline Search Call or via ULCA Web based on the description which helps the integrator to understand what a pipeline can or cannot do.\
Each pipeline ID may support multiple task and task sequences.

The same has been explained [here](https://dibdbhashini.gitbook.io/api-docs/bhashini-apis/pipeline-config-call/broken-reference) and [here](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/).

#### pipelineRequestConfig

**Type:** Dictionary\
\
This parameter takes in the configuration requested to do the sequence of tasks defined under parameter [pipelineTasks](#pipelinetasks).

### Integrators want to do individual tasks

{% tabs %}
{% tab title="Payload for Only ASR" %}
**`pipelineTasks`** array takes only one dictionary with **`taskType`** as **`asr`**&#x20;

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "asr"
    }
]
```

{% endcode %}
{% endtab %}

{% tab title="Payload for Only Translation" %}
**`pipelineTasks`** array takes only one dictionary with **`taskType`** as **`translation`**&#x20;

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "translation"
    }
]
```

{% endcode %}
{% endtab %}

{% tab title="Payload for Only TTS" %}
**`pipelineTasks`** array takes only one dictionary with **`taskType`** as **`tts`**&#x20;

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "tts"
    }
]
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Integrators want to do combination of tasks in that order

{% tabs %}
{% tab title="ASR then Translation" %}
**`pipelineTasks`** array takes two dictionaries with **`taskType`** as **`asr`** and **`translation`** in that sequence.

Requesting Server with this in the **`pipelineTasks`** parameter would mean that integrator wants to ask the server to give the configuration details where server will be able to perform **`ASR`** and **`Translation`** together by first doing ASR on the input audio, generating digital text of that audio and then also able to generate translation on the output of that ASR.

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "asr"
    },
    {
        "taskType" : "translation"
    }
]
```

{% endcode %}
{% endtab %}

{% tab title="Translation then TTS" %}

**`pipelineTasks`** array takes two dictionaries with **`taskType`** as **`translation`** and **`tts`** in that sequence.

Requesting Server with this in the **`pipelineTasks`** parameter would mean that integrator wants to ask the server to give the configuration details where server will be able to perform **`Translation`** and **`TTS`** together by first doing Translation on the input text, generating translated text in another language and then also able to generate Speech on the output of that translation.&#x20;

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "translation"
    },
    {
        "taskType" : "tts"
    }
]
```

{% endcode %}
{% endtab %}

{% tab title="ASR then Translation then TTS" %}

**`pipelineTasks`** array takes three dictionaries with **`taskType`** as **`asr`**, **`translation`** and **`tts`** in that sequence.

Requesting Server with this in the **`pipelineTasks`** parameter would mean that integrator wants to ask the server to give the configuration details where server will be able to perform **`ASR`**, **`Translation`** and **`TTS`** together by first performing **`ASR`**, thereby generating digital text from the input audio, then doing **`Translation`** on the output of previous ASR, thereby generating digital text in another language and finally doing **`TTS`** on the output of previous Translation, thereby generating Speech in the required language.&#x20;

{% code lineNumbers="true" %}

```json
"pipelineTasks" : [
    {
        "taskType" : "asr"
    },
    {
        "taskType" : "translation"
    },
    {
        "taskType" : "tts"
    }
]
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="With Configuration Parameters" %}

{% code lineNumbers="true" %}

```json
{
    "pipelineTasks": [
        {
            "taskType": "asr",
            "config": {
                "language": {
                    "sourceLanguage": "xx"
                }
            }
        },
        {
            "taskType": "translation",
            "config": {
                "language": {
                    "sourceLanguage": "xx",
                    "targetLanguage": "yy"
                }
            }
        },
        {
            "taskType": "tts",
            "config": {
                "language": {
                    "sourceLanguage": "yy"
                }
            }
        }
    ],
    "pipelineRequestConfig": {
        "pipelineId" : "xxxx8d51ae52cxxxxxxxx"
    }
}
```

{% endcode %}

### Parameters

Only additional parameter `config` is detailed out below. Rest of the parameters' understanding remains the same as [#without-configuration-parameters](#without-configuration-parameters "mention").

#### config

**Type:** dictionary\
\
`config` parameter is used for sending configuration parameters to the server for each `taskType`. Each `taskType` may have some common parameters such as `language` and some parameters which are specific to each `taskType`.

{% hint style="info" %}
Currently, there are no additional `taskType` specific parameters. Once added, they will be described here.
{% endhint %}

#### config

{% tabs %}
{% tab title="ASR" %}
**Type:** dictionary

contains:\
\
**language**\
**Type:** dictionary\
\
contains:\
\
**sourceLanguage**\
**Type:** String\
\
Source Language will take the [ISO-639 code](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) of the language as the input. This parameter will tell the server that integrator wants to receive the information and details about Speech Recognition in this specific language.
{% endtab %}

{% tab title="Translation" %}

**Type:** dictionary

contains:\
\
**language**\
**Type:** dictionary\
\
contains:\
\
**sourceLanguage**\
**Type:** String\
\
Source Language will take the [ISO-639 code](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) of the language as the input. This parameter will tell the server that integrator wants to receive the `Translation` information where the input can be translated **`FROM`** this language to another language specified in the `targetLanguage` below.\
\
and\
\
**targetLanguage**\
**Type:** String\
\
Target Language will also take the [ISO-639 code](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) of the language as the input. This parameter will tell the server that integrator wants to receive the `Translation` information where the input can be translated **`TO`** this language from another language specified un the `sourceLanguage` above.

{% hint style="info" %}
If Translation comes after ASR, and ASR is done in, say `Marathi`, then Source Language of Translation should be `Marathi` (ISO Code `mr`) because the output of ASR (Digital text in Marathi) will be fed to Translation Model.\
\
However, if Translation is the first task or the only task, integrator shall provide appropriate Source Language based on the use case.
{% endhint %}
{% endtab %}

{% tab title="TTS" %}

**Type:** dictionary

contains:\
\
**language**\
**Type:** dictionary\
\
contains:\
\
**sourceLanguage**\
**Type:** String\
\
Source Language will take the [ISO-639 code](https://app.gitbook.com/o/kPrwe957MppRhb8uqR0y/s/SuLLfCr6CWwqT0SsqOL1/) of the language as the input. This parameter will tell the server that integrator wants to receive the information and details about converting text to speech for this specific language.

{% hint style="info" %}
If TTS comes after Translation, and Translation is done, say from `Marathi` to `Hindi`, then Source Language of TTS should be `Hindi` (ISO Code `hi`) because the output of Translation (Translated text in Hindi) will be fed to Translation Model.\
\
However, if Translation is the first task or the only task, integrator shall provide appropriate Source Language based on the use case.
{% endhint %}
{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

###
