Skip to main content

A client library for accessing InteractiveAI

Project description

InteractiveAI Python SDK

MIT License PyPI Version

The official Python SDK for InteractiveAI - an observability platform for LLM applications. This SDK provides tracing, automatic instrumentation for popular LLM frameworks, and direct API access to InteractiveAI's features.

Installation

From PyPI (Production)

Install the latest stable release:

pip install interactiveai

With optional integrations:

# With OpenAI instrumentation
pip install "interactiveai[openai]"

In requirements.txt:

interactiveai>=4.0.0
# or with extras
interactiveai[openai]>=4.0.0

In pyproject.toml (Poetry):

[tool.poetry.dependencies]
interactiveai = "^4.0.0"
# or with extras
interactiveai = { version = "^4.0.0", extras = ["openai"] }

In pyproject.toml (pip/uv):

[project]
dependencies = [
    "interactiveai>=4.0.0",
]

# or with extras
[project.optional-dependencies]
llm = ["interactiveai[openai]>=4.0.0"]

From GitHub (Internal Development)

Install a specific tagged version:

pip install git+https://github.com/InteractiveAI/interactiveai-python-sdk.git@v4.1.0.dev1

Install from the main branch:

pip install git+https://github.com/InteractiveAI/interactiveai-python-sdk.git@main

In requirements.txt:

# Specific tag
interactiveai @ git+https://github.com/InteractiveAI/interactiveai-python-sdk.git@v4.1.0.dev1

# Main branch (latest)
interactiveai @ git+https://github.com/InteractiveAI/interactiveai-python-sdk.git@main

In pyproject.toml (Poetry):

[tool.poetry.dependencies]
# Specific tag
interactiveai = { git = "https://github.com/InteractiveAI/interactiveai-python-sdk.git", tag = "v4.1.0.dev1" }

# Main branch
interactiveai = { git = "https://github.com/InteractiveAI/interactiveai-python-sdk.git", branch = "main" }

Quick Start

Basic Usage

from interactiveai import InteractiveAI

# Initialize the client (uses environment variables by default)
client = InteractiveAI()

# Create a trace
trace = client.trace(name="my-llm-app")

# Create a span within the trace
span = trace.span(name="llm-call")

# ... your LLM operations ...

# End the span with output
span.end(output={"response": "Hello, world!"})

# Flush to ensure all data is sent
client.flush()

Using the @observe Decorator

from interactiveai import observe

@observe()
def my_llm_function(prompt: str) -> str:
    # Your LLM logic here
    response = call_llm(prompt)
    return response

# The function is automatically traced
result = my_llm_function("Hello!")

OpenAI Integration

from interactiveai.openai import openai

# Use openai as normal - all calls are automatically traced
response = openai.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

Configuration

The SDK is configured via environment variables:

Variable Description Default
INTERACTIVEAI_PUBLIC_KEY Your InteractiveAI public API key Required
INTERACTIVEAI_SECRET_KEY Your InteractiveAI secret API key Required
INTERACTIVEAI_HOST API endpoint URL https://cloud.interactive.ai
INTERACTIVEAI_DEBUG Enable debug logging false
INTERACTIVEAI_TRACING_ENABLED Enable/disable tracing true
INTERACTIVEAI_SAMPLE_RATE Sampling rate for traces (0.0-1.0) 1.0

Documentation

For detailed documentation, guides, and API reference, visit:

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interactiveai-1.0.0.tar.gz (239.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interactiveai-1.0.0-py3-none-any.whl (428.5 kB view details)

Uploaded Python 3

File details

Details for the file interactiveai-1.0.0.tar.gz.

File metadata

  • Download URL: interactiveai-1.0.0.tar.gz
  • Upload date:
  • Size: 239.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for interactiveai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b909643ee96ee692db6059b12464a1d0c24c8db1b0fe112d64c1ed948d2f4e6e
MD5 e383edce30779efe103c92e621fb73c6
BLAKE2b-256 a5cc8166f636b924b1125f1c8e8a10b495414d05df4e886ffbbd72894c50412c

See more details on using hashes here.

Provenance

The following attestation bundles were made for interactiveai-1.0.0.tar.gz:

Publisher: release.yml on Interactive-AI-Labs/interactiveai-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file interactiveai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: interactiveai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 428.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for interactiveai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1aa41f86311127593cba3f620db32a77244a97eb9e4da5a1e04e5b568a3172f
MD5 d15574b8a9eeb581bc59ebb61eb74bd0
BLAKE2b-256 9ea65a57f983728f52bfc688d97e27d0bb5366a8fbfcd10a5226f3e37b512281

See more details on using hashes here.

Provenance

The following attestation bundles were made for interactiveai-1.0.0-py3-none-any.whl:

Publisher: release.yml on Interactive-AI-Labs/interactiveai-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page