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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snowglobe-0.4.20.tar.gz.
File metadata
- Download URL: snowglobe-0.4.20.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5900ece7fc004da2a6f954c60843f4051bcc0563f7995c2b83e7ad5373a4111d
|
|
| MD5 |
0a18c163814904d4d6d8d991cf2a79d2
|
|
| BLAKE2b-256 |
b1b349cce187832feaf20d637b0a7e1fe86a525a728be6c764f747a4492be963
|
File details
Details for the file snowglobe-0.4.20-py3-none-any.whl.
File metadata
- Download URL: snowglobe-0.4.20-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace08601b47e206617dbc5599595eadca9b714bfef5bf6e4158f649487a5ff3b
|
|
| MD5 |
30e291dffdac55bd4ec2a2180c16f4a7
|
|
| BLAKE2b-256 |
3386535ba6066ec29bdb6566ef38e80305f96ab4c00d71cdd77e3ef7e1c192b5
|