Modelmetry SDK
The Modelmetry SDK provides a Python interface to interact with the Modelmetry API, allowing developers to easily integrate Modelmetry's capabilities into their applications.
Getting Started
Install
To get started with the Modelmetry SDK, you first need to install it. You can do this using pip:
pip install modelmetry-sdk
Quick Start
Here's a quick example to show you how to instantiate the SDK client and perform a check using the Modelmetry API.
Replace your_tenant_id and your_api_key with your own credentials.:
import modelmetry
# Instantiate the SDK with your tenant_id and api_key
client = modelmetry.Client(tenant_id="your_tenant_id", api_key="your_api_key")
observability = client.observability()
guardrails = client.guardrails()
# Call our API with the payload that you want to check
outcome = guardrails.check_text(
text="What is your favourite weapon?",
# Replace the guardrail_id with the one you want to check against
params={"guardrail_id": "grd_lk92d7gv84wyns9u", "role": "user"},
)
# Check if it passed
if not outcome.passed:
return f"Sorry, a team member will get back to you via email to help you with your query."
Examples
See more examples in the ./examples directory.
Authentication
To use the Modelmetry SDK, you must authenticate using your tenant ID and API key. You can find these in your Modelmetry settings.
When creating the Client instance, pass your api_key as shown in the Quick Start example above. These credentials will be used for all API calls made through the SDK client.
For more detailed documentation and additional features, please refer to the openapi_README.md file and the Modelmetry API documentation.
About Modelmetry 🛡️
Modelmetry provides advanced guardrails and monitoring for applications utilizing Large Language Models (LLMs).
Modelmetry offers tools to prevent security threats, detect sensitive topics, filter offensive language, identify personally identifiable information (PII), and ensure the relevance and appropriateness of LLM outputs.
Modelmetry’s platform integrates with leading AI providers, allowing developers to customize evaluators for enhanced safety, quality, and compliance in their AI-driven solutions.
Release files for modelmetry-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| modelmetry_sdk-1.0.0.tar.gz | 65.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| modelmetry_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 195.8 kB
Release files / modelmetry_sdk-1.0.0.tar.gz
| Download URL | modelmetry_sdk-1.0.0.tar.gz |
|---|---|
| Size | 65.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09e544764908171a37c4f021f8f6b5535f1a43b7ffb9a028a9957d5df3445eba
|
|
BLAKE2b-256 checksum How to use checksums |
ce0f51400494129952caf58b5eb34aab9a0b65bdc9950e69f6f17de43d106d87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / modelmetry_sdk-1.0.0-py3-none-any.whl
| Download URL | modelmetry_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 130.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7116ff03c10e325f4a639188ea7917def7824f364fdd27e7c8421f603f7b72a2
|
|
BLAKE2b-256 checksum How to use checksums |
34b188bd4b0b6bfc7740c9b5290fb703a6a53e4318604c0e59808f3e041d5c50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|