Instruments Anthropic client for OpenTelemetry
Project description
opentelemetry-instrument-anthropic-py
Autoinstrumentation for Anthropic's client library.
Project site: https://github.com/fxchen/opentelemetry-instrument-anthropic-py
Usage
Installaion
poetry add opentelemetry-instrument-anthropic
poetry run opentelemetry-bootstrap -a install
poetry run opentelemetry-instrument python your_app.py
Using auto instrumentation agent
poetry add opentelemetry-instrument-anthropic
poetry run opentelemetry-bootstrap -a install
poetry run opentelemetry-instrument python your_app.py
Manually
from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
AnthropicInstrumentor().instrument()
client = Anthropic()
client.completions.create(
prompt=f"{HUMAN_PROMPT}\nHello world\n{AI_PROMPT}",
)
🔗 Example chat.py
In this folder there's a readme on how to:
- Execute a chat completion against Anthropic
- Send traces to your console or your OLTP provider!
Acknowledgments
Thank you very much to Phillip Carter and instrumentation by the OpenTelemetry Community! This instrumentation was heavily inspired by conversation and this OpenAI library.
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 opentelemetry_instrument_anthropic-0.0.2.tar.gz.
File metadata
- Download URL: opentelemetry_instrument_anthropic-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43df3c90c9f900890e91204de168a16ce371818f656e741e5215ce78449aa3e2
|
|
| MD5 |
0cc4865969ebe873b98cb4fd88f15a56
|
|
| BLAKE2b-256 |
b4556362d6f819e7c1212a3e093862f721afaa36b6567bb460af5fb2c2029c5d
|
File details
Details for the file opentelemetry_instrument_anthropic-0.0.2-py3-none-any.whl.
File metadata
- Download URL: opentelemetry_instrument_anthropic-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9be125f51501de77c20d83b2a6e17acf59dae91724a871f3116b171471cb3920
|
|
| MD5 |
ecb7fb2bdce36bd5bbb6a186e5a6b753
|
|
| BLAKE2b-256 |
57eae588bc760161d6bbf5d106b41dbec1e5164305bfa2f2ebbd7e487c5b30d0
|