Metadata-Version: 2.4
Name: respan-instrumentation-aleph-alpha
Version: 0.1.0
Summary: Respan instrumentation plugin for Aleph Alpha
License: Apache 2.0
Author: Respan
Author-email: team@respan.ai
Requires-Python: >=3.11,<3.14
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: aleph-alpha-client (>=11.5.0)
Requires-Dist: opentelemetry-semantic-conventions-ai (>=0.5.1)
Requires-Dist: respan-sdk (>=2.6.1)
Requires-Dist: respan-tracing (>=2.17.0,<3.0.0)
Description-Content-Type: text/markdown

# respan-instrumentation-aleph-alpha

Respan instrumentation plugin for the official Aleph Alpha Python SDK.

The package patches `aleph_alpha_client.Client` and `AsyncClient` model calls
and emits canonical Respan spans through the active OTEL pipeline. It captures
sync and async chat, sync and async completion, async streaming chat and
completion, embeddings, semantic embeddings, instructable embeddings,
evaluation, explanation, prompt and completion content, token usage, tool
definitions, and model tool calls.

## Installation

```bash
pip install respan-ai respan-instrumentation-aleph-alpha aleph-alpha-client
```

## Usage

```python
import os

from aleph_alpha_client import ChatRequest, Client, Message
from aleph_alpha_client.chat import Role
from respan import Respan
from respan_instrumentation_aleph_alpha import AlephAlphaInstrumentor

respan = Respan(instrumentations=[AlephAlphaInstrumentor()])
client = Client(token=os.environ["ALEPH_ALPHA_API_KEY"])

response = client.chat(
    request=ChatRequest(
        model="llama-3.1-8b-instruct",
        messages=[Message(role=Role.User, content="Say hello in one sentence.")],
    ),
    model="llama-3.1-8b-instruct",
)
print(response.message.content)
respan.flush()
```

