respan-instrumentation-portkey
Respan instrumentation plugin for Portkey. Wraps OpenInference's Portkey instrumentor, translates spans into the Respan tracing shape, and strips off-contract helper aliases before export.
Configuration
1. Install
pip install respan-instrumentation-portkey
2. Set Environment Variables
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Your Respan API key for trace export. |
RESPAN_BASE_URL |
No | Defaults to https://api.respan.ai/api. |
PORTKEY_API_KEY |
Yes | Your Portkey API key for Portkey Gateway calls. |
PORTKEY_PROVIDER or PORTKEY_CONFIG |
Yes | Portkey provider slug or config slug. |
Quickstart
import os
from dotenv import load_dotenv
load_dotenv()
from portkey_ai import Portkey
from respan import Respan, workflow
from respan_instrumentation_portkey import PortkeyInstrumentor
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
base_url=os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api"),
instrumentations=[PortkeyInstrumentor()],
)
client = Portkey(
api_key=os.environ["PORTKEY_API_KEY"],
provider=os.getenv("PORTKEY_PROVIDER"),
config=os.getenv("PORTKEY_CONFIG"),
)
@workflow(name="portkey_chat_completion")
def run_chat() -> str:
response = client.chat.completions.create(
model=os.getenv("PORTKEY_MODEL", "gpt-4o-mini"),
messages=[{"role": "user", "content": "Say hello from Portkey."}],
)
return response.choices[0].message.content or ""
try:
print(run_chat())
finally:
respan.flush()
respan.shutdown()
Further Reading
See the Respan example projects for runnable scripts.
Metadata
Release files for respan-instrumentation-portkey 0.1.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 | Actions |
|---|---|---|---|---|
| respan_instrumentation_portkey-0.1.1.tar.gz | 10.8 kB | Without provenance | Details for respan_instrumentation_portkey-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| respan_instrumentation_portkey-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for respan_instrumentation_portkey-0.1.1-py3-none-any.whl |
Total release size: 24.2 kB
Release files / respan_instrumentation_portkey-0.1.1.tar.gz
| Download URL | respan_instrumentation_portkey-0.1.1.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02bb14a170b59417e328374db605d07d1fd6302f41d68b9dff91451d3eb247ae
|
|
BLAKE2b-256 checksum How to use checksums |
9e09f0ce600dcf5368f3c0b7edd45d70621215ec6c1dbc6d4ea78522b1a7ee58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_portkey-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_portkey-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eace0697f8b8cf7e22ba33b700226113161481bdadd97551cb7ef80bf3030206
|
|
BLAKE2b-256 checksum How to use checksums |
2696ed98e10012964b1caadc93924cbcf2bfcf209219eaef102faca094a0d01b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for respan-instrumentation-portkey 0.1.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.