Skip to main content

OpenInference smolagents Instrumentation

Project description

OpenInference smolagents Instrumentation

pypi

Python auto-instrumentation library for LLM agents implemented with smolagents

Crews are fully OpenTelemetry-compatible and can be sent to an OpenTelemetry collector for monitoring, such as arize-phoenix.

Installation

pip install openinference-instrumentation-smolagents

Quickstart

This quickstart shows you how to instrument your guardrailed LLM application

Install required packages.

pip install smolagents arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp

Start Phoenix in the background as a collector. By default, it listens on http://localhost:6006. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)

python -m phoenix.server.main serve

Set up SmolagentsInstrumentor to trace your crew and send the traces to Phoenix at the endpoint defined below.

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor

endpoint = "http://0.0.0.0:6006/v1/traces"
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)

from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel

agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel())

agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")

More Info

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openinference_instrumentation_smolagents-0.1.3.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2fdf35cc126ff6543934dd20ef459f8abeb1581dbb2803b88c6a9f4b56aeccdf
MD5 05427d090085403970221d1e85ed1bc4
BLAKE2b-256 090f37a24aa5cc1720bf9be39c6e59895ea3dda68d8daa04adf7bf88c7a0aea8

See more details on using hashes here.

File details

Details for the file openinference_instrumentation_smolagents-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55d659e65ed5e3627565f393e876a5f8f64209c6df30b7ab5aa440df9bb6dedd
MD5 d0dd8673cd4c20eeec7c762667bf96a5
BLAKE2b-256 bfdb1734248cbb4e0be3ca6860a298c135b6c07d3a473f68ad75d160045ec39c

See more details on using hashes here.

Supported by

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