Skip to main content

๐Ÿค— Observers: The go-to library for AI and Generative AI observability, enabling insights into model interactions and everything that comes with it.

Project description

llmdump

This is a lightweight library for tracking and syncing LLM completions to a local store and a Hugging Face dataset.

Usage

Tracking OpenAI Requests with wrap_openai

from openai import OpenAI
import os

store = Store().connect()

api_key = os.environ["HF_INFERENCE_API_KEY"]
openai_client = OpenAI(base_url="https://api-inference.huggingface.co/v1/", api_key=api_key)

client = wrap_openai(openai_client, store=store)

response = client.chat.completions.create(
    model="Qwen/Qwen2.5-Coder-32B-Instruct",
    messages=[
        {"role": "user", "content": "Tell me a joke."}
    ],
)

Viewing / Querying Local Store

The default store is DuckDB and can be viewed and queried using the DuckDB CLI.

> duckdb store.db
> from openai_records limit 10;
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          id          โ”‚        model         โ”‚      timestamp       โ”‚       messages       โ”‚ โ€ฆ โ”‚  error  โ”‚     raw_response     โ”‚ synced_at โ”‚
โ”‚       varchar        โ”‚       varchar        โ”‚      timestamp       โ”‚ struct("role" varcโ€ฆ  โ”‚   โ”‚ varchar โ”‚         json         โ”‚ timestamp โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 89cb15f1-d902-4586โ€ฆ  โ”‚ Qwen/Qwen2.5-Coderโ€ฆ  โ”‚ 2024-11-19 17:12:3โ€ฆ  โ”‚ [{'role': user, 'cโ€ฆ  โ”‚ โ€ฆ โ”‚         โ”‚ {"id": "", "choiceโ€ฆ  โ”‚           โ”‚
โ”‚ 415dd081-5000-4d1aโ€ฆ  โ”‚ Qwen/Qwen2.5-Coderโ€ฆ  โ”‚ 2024-11-19 17:28:5โ€ฆ  โ”‚ [{'role': user, 'cโ€ฆ  โ”‚ โ€ฆ โ”‚         โ”‚ {"id": "", "choiceโ€ฆ  โ”‚           โ”‚
โ”‚ chatcmpl-926         โ”‚ llama3.1             โ”‚ 2024-11-19 17:31:5โ€ฆ  โ”‚ [{'role': user, 'cโ€ฆ  โ”‚ โ€ฆ โ”‚         โ”‚ {"id": "chatcmpl-9โ€ฆ  โ”‚           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 3 rows                                                                                                                16 columns (7 shown) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

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

observers-0.1.0.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

observers-0.1.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: observers-0.1.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.0 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for observers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 98b5bc0a231a96a5667aa9a13810ef1ea3d42acee2f75c544089c747bbd07d92
MD5 d4503acb9c7879bf714129820c151029
BLAKE2b-256 06ed29dbe6029293edee57c838637740af751d340a1c475c24d165f261d22701

See more details on using hashes here.

File details

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

File metadata

  • Download URL: observers-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.0 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for observers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c94b3f8cb644bc6e58b07fe0d68d4a8089a7e8adb0d338565c9da052bf05953
MD5 b7389d24abbc1fbee6259c056b99db6a
BLAKE2b-256 0a056e922c8f85b0d590c8025cc5dabba9440594f6f139da66b332d780e12fa5

See more details on using hashes here.

Supported by

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