Skip to main content

client server for usage with snowglobe experiments

Project description

Snowlgobe Connect SDK

The Snowglobe Connect SDK helps you connect your AI agents to Snowglobe. It sends simulated user messages to your LLM-based application during experiments. Your application should process these messages and return a response, enabling simulated conversations and custom code based risk assessment.

Installation

# Install client
pip install snowglobe

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

uv pip install --prerelease=allow snowglobe

snowglobe-connect commands

snowglobe-connect auth  # Sets up your API key
snowglobe-connect init  # Initializes a new agent connection and creates an agent wrapper file
snowglobe-connect test  # Tests your agent connection
snowglobe-connect start  # Starts the process of processing simulated user messages
snowglobe-connect --help

When using one of our specific preview environments in .snowgloberc one can override our server's URL with:

CONTROL_PLANE_URL=

Sample custom llm usage in agent wrapper file

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

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)

Tracing & Telemetry

See our telemetry instrumentation extensions for snowglobe to help you track insightful traces from our agent:

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

snowglobe-0.8.3.tar.gz (65.7 kB view details)

Uploaded Source

Built Distribution

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

snowglobe-0.8.3-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file snowglobe-0.8.3.tar.gz.

File metadata

  • Download URL: snowglobe-0.8.3.tar.gz
  • Upload date:
  • Size: 65.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for snowglobe-0.8.3.tar.gz
Algorithm Hash digest
SHA256 2aad22df0bb2200db72336d3b169b50a567fdce50dc42948eead9fee55b6c66a
MD5 bfdeacee2385baf40bfec578c050de2f
BLAKE2b-256 bd3ef118dae147f4f949728aa8aa340260b3b5785d328f15af94756af657d7d1

See more details on using hashes here.

File details

Details for the file snowglobe-0.8.3-py3-none-any.whl.

File metadata

  • Download URL: snowglobe-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for snowglobe-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 79cf168f971cce5791f475f8cd6a22d226d3dae4a000e9c8ef0ffd7a1aa54500
MD5 da2a8f5b543131e3c2957b4075f96944
BLAKE2b-256 91dcb3a1c0bddc20c16715f174bb1fdd3d6d8b3a7c57117ea7deaa07eddb0a23

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