Skip to main content

Modelmetry SDK for Python applications.

Project description

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(
  # Replace the guardrail_id with the one you want to check against
  guardrail_id="grd_abc123xyz789", 
  # Here goes either the user input or the model output you want to check
  input_text=modelmetry.TextInput(text="What is your favourite weapon?")
  # you can also pass other payload fields here:
  # input_chat
  # output_text
  # output_chat 
)

# 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 tenant_id and 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.

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

modelmetry_sdk-0.0.5.tar.gz (64.8 kB view details)

Uploaded Source

Built Distribution

modelmetry_sdk-0.0.5-py3-none-any.whl (164.3 kB view details)

Uploaded Python 3

File details

Details for the file modelmetry_sdk-0.0.5.tar.gz.

File metadata

  • Download URL: modelmetry_sdk-0.0.5.tar.gz
  • Upload date:
  • Size: 64.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for modelmetry_sdk-0.0.5.tar.gz
Algorithm Hash digest
SHA256 aae1967a4933a648928214eb3e8d5a7dc58c31e4ee4fd2571b951355f9dd5f23
MD5 6b944693ff6d3b887963834ceafa59ad
BLAKE2b-256 09b0bd07a501357704dd33811b37b45b600da77bfde1ec4fad38879e7a7e209d

See more details on using hashes here.

File details

Details for the file modelmetry_sdk-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for modelmetry_sdk-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 55d8d3c8869cbcc73b0e2faf8f88cec005762018b0014f0ec6f8f7532da7ce15
MD5 ac2a0945b9d8066796eab3e18c285306
BLAKE2b-256 d475900dee3591b0df343ab4348626f50a4516cb6b6f8a5b7c3df92fae06fea6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page