Skip to main content

Python SDK for BEval Studio by Bolder — log LLM/VLM/agent calls to the BEval dashboard. Import as `beval`.

Project description

bolder-ai

Python SDK for BEval Studio by Bolder — log LLM/VLM/agent calls to your observability & evaluation dashboard.

Distribution name is bolder-ai. Import name is beval.

  • Fire-and-forget, non-blocking (background thread queue)
  • Works with raw calls, @trace decorator, or auto-instrumented OpenAI / Anthropic clients
  • Zero hard deps beyond httpx

Install

pip install bolder-ai
# optional integrations
pip install 'bolder-ai[openai]'
pip install 'bolder-ai[anthropic]'

Then import beval in your code.

Requires Python 3.9+.

Configure

Set environment variables (or pass to beval.init(...)):

Env Purpose
BEVAL_API_KEY Your BEval project API key (required)
BEVAL_API_URL Gateway base URL (default: https://ai-gateway.bolder.services)
BEVAL_PROJECT_ID Optional project scoping
BEVAL_DEFAULT_MODEL_ID Default model_id if not passed per-call
BEVAL_DEBUG 1 to enable debug logging

Quick start

1. Raw log

import beval

beval.init()  # reads env

beval.log(
    kind="llm",
    model_id="gpt-4o-mini",
    input="What is the capital of France?",
    output="Paris.",
    latency_ms=312,
    tokens_in=7,
    tokens_out=2,
)

2. Auto-wrap OpenAI

import beval
from openai import OpenAI

beval.init()
client = beval.wrap(OpenAI())

client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hi"}],
)

Automatically captures input messages, output, model, token counts, latency, errors. Detects image parts and logs as kind="vlm".

3. Auto-wrap Anthropic

import beval
from anthropic import Anthropic

beval.init()
client = beval.wrap(Anthropic())

client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=64,
    messages=[{"role": "user", "content": "Hi"}],
)

4. @beval.trace decorator

Wrap any function (sync or async) as an agent log:

@beval.trace
def run_agent(query: str) -> str:
    return ...

@beval.trace(name="tool:search", kind="agent")
async def search(q): ...

Captures args, return value, latency, and exceptions (logged with status="failure").

VLM / images

Pass image= to attach a base64 data URL (matches the dashboard's VLM preview):

beval.log(
    kind="vlm",
    model_id="gpt-4o",
    input="describe this",
    output="a cat",
    image=open("cat.png", "rb").read(),
    image_mime="image/png",
)

Redaction

Strip PII before send:

def redact(payload: dict) -> dict:
    if payload.get("input"):
        payload["input"] = scrub_pii(payload["input"])
    return payload

beval.init(redact=redact)

Lifecycle

  • beval.flush(timeout=5.0) — wait for queued logs to drain
  • beval.shutdown() — drain + close (runs automatically at interpreter exit)

Reliability

  • Non-blocking: log() enqueues and returns immediately
  • Network failures never raise — they're logged via the beval logger
  • Drops on queue overflow (default capacity: 10,000)
  • Retries transient errors (408/429/5xx) with exponential backoff

License

MIT

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

bolder_ai-0.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

bolder_ai-0.1.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file bolder_ai-0.1.1.tar.gz.

File metadata

  • Download URL: bolder_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bolder_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 19451fe9733f3dbac92cfa41f7332a4ae86761ce61067cb53fc930d5b8c65668
MD5 55ed2e3791675651b7eae6f087335643
BLAKE2b-256 1a520bb172a0ce66f075b683a026c3c45861df39768fe6b8b9dadbf39d33034e

See more details on using hashes here.

File details

Details for the file bolder_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bolder_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bolder_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce5449ab3ef4661e15ad579336b8f201530a38768f7bc86f4ec5ddb631a0265
MD5 cdef7db8095b372fbf9e8093e27e7f6e
BLAKE2b-256 8ec57769f67777ed43bfc690851ad7e884945fec144a9fdf2d23875e87f848cb

See more details on using hashes here.

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