Guardrails OpenTelemetry Integration
Overview
This integration provides support for using OpenTelemetry with the Guardrails framework. It enables tracing and monitoring of applications built with Guardrails.
Installation
- Install traceAI Guardrails
pip install traceAI-guardrails
Set Environment Variables
Set up your environment variables to authenticate with FutureAGI
import os
os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
Quickstart
Register Tracer Provider
Set up the trace provider to establish the observability pipeline. The trace provider:
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="guardrails_app"
)
Configure Guardrails Instrumentation
Instrument the Guardrails client to enable telemetry collection. This step ensures that all interactions with the Guardrails SDK are tracked and monitored.
from traceai_guardrails import GuardrailsInstrumentor
GuardrailsInstrumentor().instrument(tracer_provider=trace_provider)
Create Guardrails Components
Set up your Guardrails client with built-in observability.
from guardrails import Guard
guard = Guard()
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current temperature for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country e.g. Bogotá, Colombia"
}
},
"required": [
"location"
],
"additionalProperties": False
},
"strict": True
}
}]
result = guard(
messages=[
{
"role": "user",
"content": "What is the weather in Delhi?",
},
],
model="gpt-4o",
tools=tools
)
print(f"{result}")
Metadata
Release files for traceAI-guardrails 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| traceai_guardrails-0.2.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| traceai_guardrails-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / traceai_guardrails-0.2.0.tar.gz
| Download URL | traceai_guardrails-0.2.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d97ca04f66d87e6bf50e70a94a838d78dad90d401c099851ebf017209027a2c
|
|
BLAKE2b-256 checksum How to use checksums |
11dcf34e6e0d91b3afc089ec306b4c1af42ea9438ed2b7f13ac3cab8c6032bae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / traceai_guardrails-0.2.0-py3-none-any.whl
| Download URL | traceai_guardrails-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a918020215b9e49bcfd8a779641ede163e7f00811d023e090bd7df4a6a2925b
|
|
BLAKE2b-256 checksum How to use checksums |
70cb02d7a5066cf08e3c15c56d77de99625d241d4748daa9073cc8df887b4113
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|