Metadata-Version: 2.4
Name: openinference-instrumentation-pipecat
Version: 1.0.3
Summary: OpenInference Pipecat Instrumentation
Project-URL: Homepage, https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-pipecat
Author-email: OpenInference Authors <oss@arize.com>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.11
Requires-Dist: openinference-instrumentation>=0.1.50
Requires-Dist: opentelemetry-api
Requires-Dist: opentelemetry-instrumentation
Requires-Dist: opentelemetry-semantic-conventions
Requires-Dist: websockets<16.0,>=13.1
Provides-Extra: examples
Requires-Dist: arize-otel; extra == 'examples'
Requires-Dist: arize-phoenix; extra == 'examples'
Requires-Dist: pipecat-ai[local-smart-turn,openai,runner,silero,webrtc]>=1.0; extra == 'examples'
Requires-Dist: python-dotenv; extra == 'examples'
Provides-Extra: instruments
Requires-Dist: pipecat-ai>=1.0; extra == 'instruments'
Description-Content-Type: text/markdown

# OpenInference Pipecat Instrumentation

Python auto-instrumentation library for Pipecat. This library allows you to convert Pipecat traces to OpenInference, which is OpenTelemetry compatible, and view those traces in [Arize Phoenix](https://github.com/Arize-ai/phoenix).

## Compatibility

| `openinference-instrumentation-pipecat` | `pipecat-ai`     | Python   |
| --------------------------------------- | ---------------- | -------- |
| `>=1.0`                                 | `>=1.0`          | `>=3.11` |
| `<=0.1.4`                               | `<1.0` (e.g. `0.0.99`) | `>=3.10` |

Pipecat 1.0 introduced breaking changes (renamed observers, removed
`LLMMessagesFrame`, dropped Python 3.10). If you're still on `pipecat-ai<1.0`,
pin this instrumentor to `<=0.1.4`:

```shell
pip install 'openinference-instrumentation-pipecat<=0.1.4' 'pipecat-ai<1.0'
```

## Installation

```shell
pip install openinference-instrumentation-pipecat
```

## Quickstart

This quickstart shows you how to setup tracing in your Pipecat application:

```python
from phoenix.otel import register
from openinference.instrumentation.pipecat import PipecatInstrumentor

# Set up the tracer provider
tracer_provider = register(
    project_name="default" #Phoenix project name
)

# Add auto-instrumentor at the top of the application
PipecatInstrumentor().instrument(tracer_provider=tracer_provider)

# Build your Pipecat pipeline
# ... (add your Pipecat pipeline code here)

### CONFIGURATION SETUP (Transport, LLM, STT, TTS) ###

### PIPELINE ###
pipeline = Pipeline(...)

### TASK ###
task = PipelineTask(
    pipeline,
    conversation_id=conversation_id,  # conversation id is used for session tracking in Arize or Phoenix
)

### EVENT HANDLING
@transport.event_handler("on_client_connected")
async def on_client_connected(transport, client):
    await task.queue_frames([LLMRunFrame()])

### PIPELINE RUNNER ###
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(task)
```

After configuring tracing, exchanges in the running application are logged to your project in Phoenix or Arize AX.


## Example

1. Install dependencies
```bash
uv pip install -e '.[examples]'
```

or

```bash
uv pip install -r examples/trace/requirements.txt
```

2. Run example
```bash
uv run python examples/trace/001-trace.py
```
