CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-portkey-ai

Python client library for the Portkey API - Control Panel for AI Apps with unified API signature, automated fallbacks, retries, load balancing, semantic caching, virtual keys, and comprehensive observability features.

Pending
Overview
Eval results
Files

framework-integrations.mddocs/

Framework Integrations

Pre-built integrations with popular AI frameworks including LangChain and LlamaIndex callback handlers.

Capabilities

LangChain Integration

from portkey_ai.langchain import PortkeyLangchainCallbackHandler

class PortkeyLangchainCallbackHandler:
    """Callback handler for LangChain integration with Portkey observability"""
    def __init__(
        self,
        api_key: Optional[str] = None,
        base_url: Optional[str] = None,
        **kwargs
    ): ...

LlamaIndex Integration

from portkey_ai.llamaindex import PortkeyLlamaCallbackHandler

class PortkeyLlamaCallbackHandler:
    """Callback handler for LlamaIndex integration with Portkey observability"""
    def __init__(
        self,
        api_key: Optional[str] = None,
        base_url: Optional[str] = None,
        **kwargs
    ): ...

Usage Examples

# LangChain integration
from langchain.llms import OpenAI
from portkey_ai.langchain import PortkeyLangchainCallbackHandler

handler = PortkeyLangchainCallbackHandler(
    api_key="PORTKEY_API_KEY"
)

llm = OpenAI(callbacks=[handler])
response = llm("What is AI?")

# LlamaIndex integration
from llama_index.core import SimpleDirectoryReader
from portkey_ai.llamaindex import PortkeyLlamaCallbackHandler

handler = PortkeyLlamaCallbackHandler(
    api_key="PORTKEY_API_KEY"
)

# Use with LlamaIndex operations

Install with Tessl CLI

npx tessl i tessl/pypi-portkey-ai

docs

administration.md

assistants-threads.md

batch-processing.md

beta-realtime.md

chat-completions.md

configuration-management.md

container-content.md

core-client.md

embeddings.md

evaluation-testing.md

feedback-collections.md

file-management.md

fine-tuning.md

framework-integrations.md

index.md

key-management.md

models.md

multimodal-apis.md

observability-analytics.md

prompt-management.md

provider-integration.md

text-completions.md

uploads.md

vector-stores.md

tile.json