Respan instrumentation plugin for Dify
Project description
Respan Dify instrumentation
Trace the dify-client Python package with Respan.
This package patches Dify's Service API client methods and emits canonical Respan spans for chat, completion, workflow, file, feedback, application, and conversation requests. Streaming responses are traced when the returned stream is consumed.
Install
pip install respan-ai respan-instrumentation-dify dify-client
Usage
import os
from dify_client import ChatClient
from respan import Respan
from respan_instrumentation_dify import DifyInstrumentor
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
instrumentations=[DifyInstrumentor()],
)
client = ChatClient(os.environ["DIFY_CHAT_API_KEY"])
response = client.create_chat_message(
inputs={},
query="Reply with one concise sentence about tracing.",
user="respan-example-user",
response_mode="blocking",
)
response.raise_for_status()
print(response.json()["answer"])
respan.flush()
respan.shutdown()
Use Respan.propagate_attributes(...) to attach customer, thread, trace group,
metadata, or prompt context to Dify spans.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_dify-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_dify-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ae7d12ef39e02d032323fa6bf56c357ef53316190a93d1d6bea1ebb6c23708b
|
|
| MD5 |
823b19674aed81d3fb7951dbb40ce072
|
|
| BLAKE2b-256 |
0b1e9da390843a248320facac94fdb92d195a49c349ad6b49262f59728e0f92a
|
File details
Details for the file respan_instrumentation_dify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_dify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8a34042a71f193a78b50fc816ef5ad8cd4eff12f6fb559a9cb4fa8a98eaa02e
|
|
| MD5 |
3f90586feffbe15edc8aa43c5ca22e69
|
|
| BLAKE2b-256 |
7261f7d247bcc5038de0522f113df959e3d2dab0fead2d0fb734098bc25d16be
|