Observability for Generative AI
Project description
GenAI Monitor
Observability for Generative AI
Overview
GenAI Monitor provides robust observability tools for Generative AI applications with zero additional effort. Simply import the library, and it automatically monitors, tracks, and analyzes your AI model's inputs, outputs, and performance in production environments - no code changes required to your existing AI workflows.
The library seamlessly integrates with popular AI frameworks and automatically captures model calls, stores responses for later retrieval without requiring you to modify your application code.
Features
-
Implicit Observability for Popular Frameworks: Works out-of-the-box with most popular frameworks and providers without any code changes: Transformers, Diffusers, OpenAI, LiteLLM
-
Persistent Data Storage & Retrieval: Store model inputs and outputs so identical calls can be retrieved from the database without re-running expensive and time consuming model inference.
-
Custom Function & Method Registration: Easily extend monitoring to any GenAI tool. The flexible registration system allows you to monitor any Python function or method with minimal configuration.
-
Artifact Tracking: Attach metadata and artifacts to model calls for comprehensive traceability.
-
Modular Installation: Install only what you need to keep your dependencies lean.
Installation
To start tracking your GenAI models, install the genai-monitor package:
pip install genai-monitor
Install with support for specific frameworks:
# HuggingFace Transformers
pip install genai-monitor[transformers]
# Diffusers
pip install genai-monitor[diffusers]
# OpenAI
pip install genai-monitor[openai]
# LiteLLM
pip install genai-monitor[litellm]
Quick Start
GenAI Monitor automatically intercepts calls to supported frameworks. When you make the second API call with identical parameters, GenAI Monitor retrieves the cached response directly from the database instead of sending another request to OpenAI - saving time, reducing costs, and decreasing latency. This all happens transparently without any changes to your application code - simply import the library and it works!
import os
# Import genai_monitor.auto to automatically enable monitoring
# for supported frameworks with zero code changes
import genai_monitor.auto
from openai import OpenAI
api_key = os.getenv("OPENAI_API_KEY")
client = OpenAI(api_key=api_key)
question = "What if the meaning of life is to be happy? Answer in single sentence."
# First API call - This request is sent to OpenAI and the result is stored in the database
response = client.chat.completions.create(
messages=[{"role": "user", "content": question}],
model="gpt-4o-mini-2024-07-18",
max_tokens=40,
temperature=0.4,
)
print(response.choices[0].message.content)
# Second API call with identical parameters -
# NO request is sent to OpenAI! Instead, the result is retrieved from the local database
response = client.chat.completions.create(
messages=[{"role": "user", "content": question}],
model="gpt-4o-mini-2024-07-18",
max_tokens=40,
temperature=0.4,
)
print(response.choices[0].message.content)
# The application code remains unchanged, but you save time and API costs
Documentation
Full documentation for GenAI Monitor is available here.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details on how to contribute to this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genai_monitor-0.0.1.tar.gz.
File metadata
- Download URL: genai_monitor-0.0.1.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2fc2e7f3c9f62da0d19847cc8e0ea5248d11e6336ea10e70b2f90ef774b040b
|
|
| MD5 |
a0b8ea819d1fc939110e67a51e88cd60
|
|
| BLAKE2b-256 |
fe66cd9bbfdbf3711e7ca12ab92057cd379fcb4184d29cf742c4e3ebb5d4a2c7
|
Provenance
The following attestation bundles were made for genai_monitor-0.0.1.tar.gz:
Publisher:
release.yml on deepsense-ai/GenAI-Monitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genai_monitor-0.0.1.tar.gz -
Subject digest:
d2fc2e7f3c9f62da0d19847cc8e0ea5248d11e6336ea10e70b2f90ef774b040b - Sigstore transparency entry: 200692652
- Sigstore integration time:
-
Permalink:
deepsense-ai/GenAI-Monitor@0d0df226b3d199501c718c1b94e18bc0eb4ba0d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepsense-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d0df226b3d199501c718c1b94e18bc0eb4ba0d1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file genai_monitor-0.0.1-py3-none-any.whl.
File metadata
- Download URL: genai_monitor-0.0.1-py3-none-any.whl
- Upload date:
- Size: 61.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfeae1d4f766890079802b4aa6585d7d3c975e44351a1f20e07ac97c41d43e54
|
|
| MD5 |
09580bf38d1bb7c8e42a518940f4cd2f
|
|
| BLAKE2b-256 |
d93ec6535b550520c20c0c942d0ec7bbbab2c91580bd82d5f770ef2d16a496e6
|
Provenance
The following attestation bundles were made for genai_monitor-0.0.1-py3-none-any.whl:
Publisher:
release.yml on deepsense-ai/GenAI-Monitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genai_monitor-0.0.1-py3-none-any.whl -
Subject digest:
dfeae1d4f766890079802b4aa6585d7d3c975e44351a1f20e07ac97c41d43e54 - Sigstore transparency entry: 200692653
- Sigstore integration time:
-
Permalink:
deepsense-ai/GenAI-Monitor@0d0df226b3d199501c718c1b94e18bc0eb4ba0d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepsense-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d0df226b3d199501c718c1b94e18bc0eb4ba0d1 -
Trigger Event:
workflow_dispatch
-
Statement type: