Metadata-Version: 2.5
Name: dtelecom-pipecat
Version: 0.1.1
Summary: dTelecom room transport and speech services for Pipecat
Project-URL: Documentation, https://github.com/dTelecom/agents-python/tree/main/pipecat#readme
Project-URL: Source, https://github.com/dTelecom/agents-python
Project-URL: Issues, https://github.com/dTelecom/agents-python/issues
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: dtelecom-server-sdk==0.1.0
Requires-Dist: pipecat-ai<1.18,>=1.17.0
Provides-Extra: rtc
Requires-Dist: dtelecom-rtc==0.1.1; extra == 'rtc'
Description-Content-Type: text/markdown

# dTelecom for Pipecat

Use dTelecom streaming speech in a Pipecat pipeline, or join a dTelecom room with the RTC transport. Speech services accept a dTelecom Cloud client or a single-use speech key with a refresh callback.

Install `dtelecom-pipecat` for speech services. Install `dtelecom-pipecat[rtc]` to send audio and application messages in a room. Supply the URL, participant token and ranked fallbacks from your backend. Room credentials and speech credentials have different scopes.

Use `DTelecomSTTService` and `DTelecomTTSService` from `dtelecom_pipecat`, or import `DTelecomTransport` from `dtelecom_pipecat.transport`. Each component can be used independently. Recognition expects mono PCM and associates transcripts with the input participant. Synthesis produces 48 kHz mono PCM. Service readiness and partial retirement events carry the original service metadata in `SpeechSessionFrame`.

The [room voice agent](https://github.com/dTelecom/agents-python/blob/main/pipecat/examples/room_agent.py) uses dTelecom for its room, recognition and voice, and OpenRouter for its LLM. Set the dTelecom Cloud variables and the LLM credentials on the server. The example issues the bot's grant and prints the generated room name. Give a browser participant its own grant for that room through your backend. The example uses the provider's final recognition result to propose a turn end. When using Pipecat's own turn strategy, leave `propose_turns=False`.

To synthesize SSML, pass an entire document to the speech client or use a Pipecat TTS service configured with `input_format="ssml"` where the upstream processor provides one complete document per request. Optional watermarking requires server support. For translation or file jobs, a Pipecat function or processor can call the same `CloudClient` used to issue the room grant.

## Run the room example

Install the RTC extra and Pipecat's OpenRouter integration in the same environment. Set `DTELECOM_CLOUD_URL`, `DTELECOM_API_KEY`, `DTELECOM_API_SECRET`, and `OPENROUTER_API_KEY` on your server. Run the following commands from the `pipecat/` directory of this checkout. Use the same room name in the agent and your browser grant issuer.

```sh
python -m pip install 'dtelecom-pipecat[rtc]' 'pipecat-ai[openrouter]>=1.17,<1.18'
ROOM_NAME=voice-demo python examples/room_agent.py
```

For a browser client and local grant issuer, use the [FastAPI example](https://github.com/dTelecom/server-sdk-python/tree/main/examples/fastapi) with `DTELECOM_EXAMPLE_ROOM=voice-demo`.

## Call another Cloud service from a Pipecat tool

An LLM tool can invoke translation on demand. Reuse the call ID as the idempotency key if the operation is retried. Register the handler for the corresponding tool schema in your existing pipeline.

```python
from pipecat.services.llm_service import FunctionCallParams

async def translate(params: FunctionCallParams):
    request = await cloud.translate(
        params.arguments["text"],
        params.arguments["target"],
        idempotency_key=params.tool_call_id,
    )
    await params.result_callback(request.model_dump(mode="json"))
```
