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.0.tar.gz (9.5 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.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bolder_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 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.0.tar.gz
Algorithm Hash digest
SHA256 88f6e88a46edaa047a5fdbe0a8bb0412c539acbab066e1470b1740e293e2cb9b
MD5 905dd073d54e9284f6cc02423a48ed13
BLAKE2b-256 75fc252095737cb6e92b72b2784084b92a15ac991e7fa4497109deb9eba790f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bolder_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dc13f74ade881a90956f7e1520a10f878b3bd9bd2186a39b5e46e0b85c21c0f
MD5 7c8ba8284b8a7f7b8c4bbb05b398625f
BLAKE2b-256 f209a244754130c3c101fdae5662364693bfb1ae9bdc030736a0f3b4b908d81d

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