Skip to main content

Snowlgobe Telemetry Instrumentation for MLflow

Instrument your Snowglobe connected app with MLflow and start collecting insightful traces when you run Simulations in Snowglobe. Read more about MLflow's tracing capability for GenAI Apps here.

Installation

pip install snowglobe-telemetry-mlflow

If using uv, set the --prerelease=allow flag

uv pip install --prerelease=allow snowglobe-telemetry-mlflow

Add the MLflowInstrumentor to your agent file

Reminder: Each agent wrapper file resides in the root directory of your project, and is named after the agent (e.g. My Agent Name becomes my_agent_name.py).

from snowglobe.client import CompletionRequest, CompletionFunctionOutputs
from openai import OpenAI
import os

### Add these two lines to your agent file and watch context rich traces come in!
from snowglobe.telemetry.mlflow import MLflowInstrumentor
MLflowInstrumentor().instrument()


client = OpenAI(api_key=os.getenv("SNOWGLOBE_API_KEY"))

def completion_fn(request: CompletionRequest) -> CompletionFunctionOutputs:
    """
    Process a scenario request from Snowglobe.
    
    This function is called by the Snowglobe client to process requests. It should return a
    CompletionFunctionOutputs object with the response content.

    Example CompletionRequest:
    CompletionRequest(
        messages=[
            SnowglobeMessage(role="user", content="Hello, how are you?", snowglobe_data=None),
        ]
    )

    Example CompletionFunctionOutputs:
    CompletionFunctionOutputs(response="This is a string response from your application")
    
    Args:
        request (CompletionRequest): The request object containing the messages.

    Returns:
        CompletionFunctionOutputs: The response object with the generated content.
    """

    # Process the request using the messages. Example:
    messages = request.to_openai_messages()
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=messages
    )
    return CompletionFunctionOutputs(response=response.choices[0].message.content)

Enhancing Snowglobe Connect SDK's Traces with Autologging

You can turn on mlflow autologging in your app to add additional context to the traces the Snowglobe Connect SDK captures. In your agent wrapper file, simply call the appropriate autolog method for the LLM provider you're using. The below example shows how to enable this for OpenAI:

import mlflow

mlflow.openai.autolog()

Metadata

Release files for snowglobe-telemetry-mlflow 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snowglobe-telemetry-mlflow 0.0.2
File Size Uploaded Provenance
snowglobe_telemetry_mlflow-0.0.2.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for snowglobe-telemetry-mlflow 0.0.2
File Interpreter ABI Platform
snowglobe_telemetry_mlflow-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / snowglobe_telemetry_mlflow-0.0.2.tar.gz

Download URL snowglobe_telemetry_mlflow-0.0.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
44e42e43cb35a3d83171d07cd429ca7acbb67447c923900b15809642c7caba9b
BLAKE2b-256 checksum
How to use checksums
29f8aabd2448edfb4aa89395b49750984c9de74c4e9e655c245cf4f3bdc598cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / snowglobe_telemetry_mlflow-0.0.2-py3-none-any.whl

Download URL snowglobe_telemetry_mlflow-0.0.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6722a7e9d10f9d019dac80e0b29187cb66ee05207a3a8af3b92827d7c92f5a4
BLAKE2b-256 checksum
How to use checksums
0d6af63ee1ac6e348609a0c1e37285e55e25ce5c5b45e0f4c4b7bfd7dbb95240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for snowglobe-telemetry-mlflow 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page