TraceAI Portkey Instrumentation
This is a simple example of how to use TraceAI's Portkey Instrumentation.
Requirements
portkey_aitraceai_portkey
pip install portkey_ai traceai_portkey
Register a new project with the auto instrumentor with the Portkey client.
from dotenv import load_dotenv
from portkey_ai import Portkey
from traceai_portkey import PortkeyInstrumentor
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType, EvalTag, EvalTagType, EvalSpanKind, EvalName, ModelChoices
# Load API keys from .env file
load_dotenv()
# --- Configure Future AGI Tracing Once ---
tracer_provider = register(
project_name="My-AI-App",
eval_tags=[
EvalTag(
type=EvalTagType.OBSERVATION_SPAN,
value=EvalSpanKind.LLM,
eval_name=EvalName.CONTEXT_ADHERENCE,
custom_eval_name="Response_Quality"
)
]
)
# Instrument the Portkey client
PortkeyInstrumentor().instrument(tracer_provider=tracer_provider)
# --- Your application logic remains the same! ---
client = Portkey(virtual_key="your-portkey-virtual-key")
completion = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a 6-word story about a robot who discovers music."}]
)
print(completion.choices[0].message.content)
Metadata
Release files for traceAI-portkey 0.1.2
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 | Actions |
|---|---|---|---|---|
| traceai_portkey-0.1.2.tar.gz | 5.9 kB | Without provenance | Details for traceai_portkey-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| traceai_portkey-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for traceai_portkey-0.1.2-py3-none-any.whl |
Total release size: 14.9 kB
Release files / traceai_portkey-0.1.2.tar.gz
| Download URL | traceai_portkey-0.1.2.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73d7b68b7276c076b4383fc02d39fccd5981a9823e998a7f6079aa7ba997fa71
|
|
BLAKE2b-256 checksum How to use checksums |
d356c830e11cf906e08afee97e83490d213d3c87b39511916250d9447d7f7428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / traceai_portkey-0.1.2-py3-none-any.whl
| Download URL | traceai_portkey-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
187631b46d7dd3163464bcb1283064880a4392285e2b24ee3c77c75d33ca480c
|
|
BLAKE2b-256 checksum How to use checksums |
da4e50310e8615195e99d1698f47574d31fb53e280d8f8396e75f73b3902975d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for traceAI-portkey 0.1.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.