> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# कई रिक्वेस्ट को जोड़ना

> **Note**
>
> **कैसे करें गाइड** · मानता है कि आपने [ElevenAPI क्विकस्टार्ट](/docs/hi/eleven-api/quickstart) पूरा कर लिया है।

बड़े टेक्स्ट को ऑडियो में बदलते समय, आपको एक चंक से दूसरे चंक में प्रोसोडी में अचानक बदलाव सुनाई दे सकता है। यह खास तौर पर तब साफ़ दिखता है, जब टेक्स्ट कई पैराग्राफ़ या सेक्शन में फैला हो। कई चंक्स में वॉइस प्रोसोडी बनाए रखने के लिए, आप रिक्वेस्ट स्टिचिंग सुविधा का इस्तेमाल कर सकते हैं।

इस सुविधा से आप यह संदर्भ दे सकते हैं कि पहले क्या जनरेट हो चुका है और आगे क्या जनरेट होगा। इससे पूरे टेक्स्ट में वॉइस और प्रोसोडी एक जैसी बनी रहती है।

> **Info**
>
> रिक्वेस्ट स्टिचिंग `eleven_v3` मॉडल के लिए उपलब्ध नहीं है।

रिक्वेस्ट स्टिचिंग के बिना एक उदाहरण:

और रिक्वेस्ट स्टिचिंग के साथ वही उदाहरण:

## रिक्वेस्ट स्टिचिंग का इस्तेमाल कैसे करें

ElevenLabs SDKs का इस्तेमाल करने पर रिक्वेस्ट स्टिचिंग सबसे आसान होती है।

> **Note**
>
> यह गाइड मानती है कि आपने [अपनी API key और SDK सेट अप कर ली है](/docs/hi/eleven-api/quickstart)। अगर नहीं की है, तो पहले
> क्विकस्टार्ट पूरा करें।

#### कई रिक्वेस्ट को एक साथ जोड़ें

अपनी चुनी हुई भाषा के अनुसार `example.py` या `example.mts` नाम की नई फ़ाइल बनाएं और इसमें यह कोड जोड़ें:

```python
import os
from io import BytesIO
from elevenlabs.client import ElevenLabs
from elevenlabs.play import play
from dotenv import load_dotenv

load_dotenv()

ELEVENLABS_API_KEY = os.getenv("ELEVENLABS_API_KEY")

elevenlabs = ElevenLabs(
    api_key=ELEVENLABS_API_KEY,
)

paragraphs = [
    "The advent of technology has transformed countless sectors, with education ",
    "standing out as one of the most significantly impacted fields.",
    "In recent years, educational technology, or EdTech, has revolutionized the way ",
    "teachers deliver instruction and students absorb information.",
    "From interactive whiteboards to individual tablets loaded with educational software, ",
    "technology has opened up new avenues for learning that were previously unimaginable.",
    "One of the primary benefits of technology in education is the accessibility it provides.",
]

request_ids = []
audio_buffers = []

for paragraph in paragraphs:
    # Usually we get back a stream from the convert function, but with_raw_response is
    # used to get the headers from the response
    with elevenlabs.text_to_speech.with_raw_response.convert(
        text=paragraph,
        voice_id="T7QGPtToiqH4S8VlIkMJ",
        model_id="eleven_v4",
        previous_request_ids=request_ids
    ) as response:
        request_ids.append(response._response.headers.get("request-id"))

        # response._response.headers also contains useful information like 'character-cost',
        # which shows the cost of the generation in characters.

        audio_data = b''.join(chunk for chunk in response.data)
        audio_buffers.append(BytesIO(audio_data))

combined_stream = BytesIO(b''.join(buffer.getvalue() for buffer in audio_buffers))

play(combined_stream)
```

```typescript
import "dotenv/config";
import { ElevenLabsClient, play } from "@elevenlabs/elevenlabs-js";
import { Readable } from "node:stream";

const elevenlabs = new ElevenLabsClient({
    apiKey: process.env.ELEVENLABS_API_KEY,
});

const paragraphs = [
    "The advent of technology has transformed countless sectors, with education ",
    "standing out as one of the most significantly impacted fields.",
    "In recent years, educational technology, or EdTech, has revolutionized the way ",
    "teachers deliver instruction and students absorb information.",
    "From interactive whiteboards to individual tablets loaded with educational software, ",
    "technology has opened up new avenues for learning that were previously unimaginable.",
    "One of the primary benefits of technology in education is the accessibility it provides.",
];

const requestIds: string[] = [];
const audioBuffers: Buffer[] = [];

for (const paragraph of paragraphs) {
    // Usually we get back a stream from the convert function, but withRawResponse() is
    // used to get the headers from the response
    const response = await elevenlabs.textToSpeech
        .convert("T7QGPtToiqH4S8VlIkMJ", {
            text: paragraph,
            modelId: "eleven_v4",
            previousRequestIds: requestIds,
        })
        .withRawResponse();

    // response.rawResponse.headers also contains useful information like 'character-cost',
    // which shows the cost of the generation in characters.

    requestIds.push(response.rawResponse.headers.get("request-id") ?? "");

    // Convert stream to buffer
    const chunks: Buffer[] = [];
    for await (const chunk of response.data) {
        chunks.push(Buffer.from(chunk));
    }
    audioBuffers.push(Buffer.concat(chunks));
}

// Create a single readable stream from all buffers
const combinedStream = Readable.from(Buffer.concat(audioBuffers));

play(combinedStream);
```

#### कोड चलाएं

```python
python example.py
```

```typescript
npx tsx example.mts
```

आपको संयुक्त स्टिच किया हुआ ऑडियो चलता सुनाई देना चाहिए।

## अक्सर पूछे जाने वाले सवाल

#### रिक्वेस्ट स्टिचिंग स्ट्रीमिंग के साथ कैसे काम करती है?

कंडीशनिंग के लिए पिछली रिक्वेस्ट की request IDs इस्तेमाल करने हेतु, उस रिक्वेस्ट का पूरी तरह प्रोसेस होना ज़रूरी है। स्ट्रीमिंग में इसका मतलब है कि रिस्पॉन्स बॉडी से ऑडियो को पूरी तरह पढ़ना होगा।

#### रिक्वेस्ट स्टिचिंग से कितना फ़र्क पड़ता है?

फ़र्क इस्तेमाल किए गए मॉडल, वॉइस और वॉइस सेटिंग्स पर निर्भर करता है।

#### request IDs कितनी पुरानी हो सकती हैं?

request IDs दो घंटे से पुरानी नहीं होनी चाहिए।

#### क्या रिक्वेस्ट स्टिचिंग हर प्लान में उपलब्ध है?

हाँ, जब तक आप ज़्यादा प्राइवेसी ज़रूरतों वाले एंटरप्राइज़ यूज़र नहीं हैं।

## अगले चरण

#### [TTS स्ट्रीमिंग](/docs/hi/eleven-api/guides/how-to/text-to-speech/streaming)

कम लेटेंसी प्लेबैक के लिए ऑडियो जनरेट होते ही उसे क्रमिक रूप से स्ट्रीम करें।

#### [API रेफरेंस](/docs/hi/api-reference/text-to-speech/stream)

रिक्वेस्ट स्टिचिंग पैरामीटर्स का पूरा रेफरेंस।