Skip to main content

Respan instrumentation plugin for the Writer Python SDK

Project description

respan-instrumentation-writer

Respan instrumentation plugin for the Writer Python SDK.

This package patches Writer client resource methods and emits spans using the Respan/Traceloop GenAI attribute shape used across this repository.

Install

pip install respan-instrumentation-writer

Quickstart

import os

from respan import Respan
from respan_instrumentation_writer import WriterInstrumentor
from writerai import Writer

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[WriterInstrumentor()],
)

client = Writer(api_key=os.environ["WRITER_API_KEY"])

completion = client.chat.chat(
    model="palmyra-x5",
    messages=[{"role": "user", "content": "Write one line about tracing."}],
    max_tokens=64,
)

print(completion.choices[0].message.content)
respan.flush()

Notes

  • The instrumentor patches both Writer and AsyncWriter resources.
  • chat.chat(), streamed chat, text completions, Knowledge Graph questions, application content generation, vision, translation, and direct Writer tool calls are traced.
  • Writer-specific SDK field names stay local to this package; emitted spans use canonical GenAI/LLM and Respan-owned attribute constants.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_writer-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

respan_instrumentation_writer-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file respan_instrumentation_writer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_writer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7da6a1e6bd155ddc11b0e4b2c0dd491affd75a65a78eec7c6dbf50fc10137939
MD5 a001bc848026f93b90d6812e476df25e
BLAKE2b-256 966a429c9c4ebf72daca15dd9af7956ba27189f27400001acb2399f13d232431

See more details on using hashes here.

File details

Details for the file respan_instrumentation_writer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_writer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3df69b8c2403f6a914414b47052f0ad67f149896878ab738465363e33dc0d5ab
MD5 bb8fcdebe39278d4bdefd094596430c4
BLAKE2b-256 1484b2d979c721e230ab139d124f78406d6792150f7c9d60e7955789439ae5f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page