opentelemetry-instrument-openai
It's OpenTelemetry instrumentation (python) for OpenAI's library.
Project site: https://github.com/cartermp/opentelemetry-instrument-openai-py
Supported APIs:
- Chat
- Embeddings
- Moderation
- Image (generation, edit, variation)
- Audio (transcribe, translate)
- Completion (GPT-3)
- Edit (GPT-3)
How to use it
Simple! First, install this package.
Usage
With autoinstrumentation agent:
poetry add opentelemetry-instrument-openai
poetry run opentelemetry-bootstrap -a install
poetry run opentelemetry-instrument python your_app.py
If you prefer to do it in code, you can do that too:
import openai
from dotenv import load_dotenv
from opentelemetry.instrument.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument()
load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role":"user", "content":"Tell me a joke about opentelemetry"}],
)
You can then run your app normally with your own opentelemetry initialization.
How to develop
Get poetry.
Now install and run tests:
poetry install
poetry run pytest
Now you can develop and run tests as you go!
How to run the example
Click the example folder and read the README.
Metadata
Release files for opentelemetry-instrument-openai 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| opentelemetry_instrument_openai-0.7.1.tar.gz | 8.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentelemetry_instrument_openai-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / opentelemetry_instrument_openai-0.7.1.tar.gz
| Download URL | opentelemetry_instrument_openai-0.7.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f751eef76758e733972c42c2df036cbe30c0fa3e757dcc81c99a3335e70da72f
|
|
BLAKE2b-256 checksum How to use checksums |
8b913410ae1327532beac1ab8670096c1f20e15fc405ab36be42705625ac9efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.9.18 Linux/6.5.0-1016-azure
|
Release files / opentelemetry_instrument_openai-0.7.1-py3-none-any.whl
| Download URL | opentelemetry_instrument_openai-0.7.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfe5dbe8ca7140bd4db06670a528eb2576470dd34a7e398b9f505aad55bb56c4
|
|
BLAKE2b-256 checksum How to use checksums |
d0531d254187ca210af444e3b3317c9bc738fd90254c2df99e131773f5889053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.9.18 Linux/6.5.0-1016-azure
|
Security for opentelemetry-instrument-openai 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.