Llama Index OpenTelemetry Integration
Overview
This integration provides support for using OpenTelemetry with the Llama Index framework. It enables tracing and monitoring of applications built with Llama Index.
Installation
- Install traceAI Llama Index
pip install traceAI-llamaindex
- Install Llama Index
pip install llama-index
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="llama_index_app"
)
Configure Llama Index Instrumentation
Instrument the Llama Index client to enable telemetry collection. This step ensures that all interactions with the Llama Index SDK are tracked and monitored.
from traceai_llamaindex import LlamaIndexInstrumentor
LlamaIndexInstrumentor().instrument(tracer_provider=trace_provider)
Create Llama Index Components
Set up your Llama Index client with built-in observability.
from llama_index.agent.openai import OpenAIAgent
from llama_index.core import Settings
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai import OpenAI
def multiply(a: int, b: int) -> int:
"""Multiply two integers and return the result."""
return a * b
def add(a: int, b: int) -> int:
"""Add two integers and return the result."""
return a + b
multiply_tool = FunctionTool.from_defaults(fn=multiply)
add_tool = FunctionTool.from_defaults(fn=add)
agent = OpenAIAgent.from_tools([multiply_tool, add_tool])
Settings.llm = OpenAI(model="gpt-3.5-turbo")
if __name__ == "__main__":
response = agent.query("What is (121 * 3) + 42?")
print(response)
Metadata
Release files for traceAI-llamaindex 0.1.9
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_llamaindex-0.1.9.tar.gz | 19.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| traceai_llamaindex-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / traceai_llamaindex-0.1.9.tar.gz
| Download URL | traceai_llamaindex-0.1.9.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d73ff92b8c4c3ab1fc894d30db8cc196521c433a991254624c688f7180bce5ba
|
|
BLAKE2b-256 checksum How to use checksums |
a2a08c25202ae98f70d20898df2011e900f7b282854c6098bd537734c4c7a7a2
|
| 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_llamaindex-0.1.9-py3-none-any.whl
| Download URL | traceai_llamaindex-0.1.9-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27bb8073e78c5637ef2139c49f3cada6087f03c4e50f6c9f6ec5201913793953
|
|
BLAKE2b-256 checksum How to use checksums |
42bf57c201693c23c549a36aad823bb2b4554dc294e3903e9ef4ae101e47e924
|
| 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}
|