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.4.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0adaeed9b58a832323b37cb9f08d22c8d114c6f52293374643550568d3799120
MD5 21d681f0364cbd8c3264f3e2c2704786
BLAKE2b-256 1f7b0b02a630d819cf8fe4fd5e28181dbc84262a3d251463bb4f7d490f2a1114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3d7dd238259a0b06fd5d795e00963097d1b77d7c646acd309e7caeb751cacba8
MD5 57aa3955b093345c88d39bb0a3df06ee
BLAKE2b-256 f295a11d3c72b8b775547bd6095e0b119175bf23f6520ec5e2a7c3cda11637e0

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