Skip to content

Get started with AI Observability

This guide demonstrates how to implement real-time cost tracking, token usage monitoring, hallucination detection, and latency optimization for your AI applications with OpenTelemetry traces and metrics.

Agent chat and span attributes for a LangGraph workflow in Shield360 Telemetry
flowchart TB;
subgraph " "
direction LR;
subgraph " "
direction LR;
Shield360_SDK[Shield360 SDK] -->|Sends Traces & Metrics| OTC[OpenTelemetry Collector];
OTC -->|Stores Data| ClickHouseDB[ClickHouse];
end
subgraph " "
direction RL;
Shield360_UI[Shield360] -->|Pulls Data| ClickHouseDB;
end
end
Deploy Shield360
Git clone Shield360 repository
Terminal window
git clone git@github.com:ThinkfleetAI/Shield360.git
Start Docker Compose

From the root directory of the Shield360 distribution, Run the below command:

Terminal window
docker compose up -d
Install Shield360 SDK
Terminal window
pip install shield360
Instrument your AI application
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")

Examples:

from openai import OpenAI
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
client = OpenAI(
api_key="YOUR_OPENAI_KEY"
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "What is LLM Observability?",
}
],
model="gpt-3.5-turbo",
)
import os
from anthropic import Anthropic
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
client = Anthropic(
# This is the default and can be omitted
api_key=os.environ.get("ANTHROPIC_API_KEY"),
)
message = client.messages.create(
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Hello, What is LLM Observability?",
}
],
model="claude-3-opus-20240229",
)
import cohere
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
co = cohere.Client(
api_key="YOUR_API_KEY",
)
chat = co.chat(
message="hello world!",
model="command"
)
from litellm import completion
import os
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
os.environ["HUGGINGFACE_API_KEY"] = "huggingface_api_key"
# e.g. Call 'WizardLM/WizardCoder-Python-34B-V1.0' hosted on HF Inference endpoints
response = completion(
model="huggingface/WizardLM/WizardCoder-Python-34B-V1.0",
messages=[{ "content": "Hello, how are you?","role": "user"}],
api_base="https://my-endpoint.huggingface.cloud"
)
from langchain_core.messages import HumanMessage, SystemMessage
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
from langchain_openai import ChatOpenAI
model = ChatOpenAI(model="gpt-4o-mini")
messages = [
SystemMessage(content="Translate the following from English into Italian"),
HumanMessage(content="hi!"),
]
model.invoke(messages)
import ollama
import shield360
shield360.init(otlp_endpoint="http://127.0.0.1:4318")
response = ollama.chat(model='llama3.1', messages=[
{
'role': 'user',
'content': 'Why is the sky blue?',
},
])

Refer to Shield360 SDK configuration reference or TypeScript SDK reference for more advanced configurations and use cases.

Monitor, debug and test the quality of your AI applications

With real-time LLM observability data now flowing to Shield360, visualize comprehensive AI performance metrics including token costs, latency patterns, hallucination rates, and model accuracy to optimize your production AI applications.

Just head over to Shield360 at 127.0.0.1:3000 on your browser to start exploring. You can login using the default credentials

  • Email: user@shield360.ai
  • Password: shield360user

You’re all set! Your AI applications now have observability with real-time performance monitoring, cost tracking, and AI safety evaluations.

Send Observability telemetry to other OpenTelemetry backends

flowchart TB;
subgraph " "
direction LR;
ApplicationCode[Application Code] -->|Instrumented with| Shield360_SDK[Shield360 SDK];
Shield360_SDK -->|Sends Traces & Metrics| OT_Backend[OpenTelemetry Backend];
end

If you wish to send telemetry directly from the SDK to another backend, you can stop the current Docker services by using the command below. For more details on sending the data to your existing OpenTelemetry backends, checkout our Supported Destinations guide.

Terminal window
docker compose down

If you have any questions or need support, reach out to our community.