Skip to main content

Guardrails module for Ragbits components

Project description

Ragbits Guardrails

Ragbits Guardrails is a Python package that contains utilities for ensuring the safety and relevance of responses generated by Ragbits components.

Installation

You can install the latest version of Ragbits Guardrails using pip:

pip install ragbits-guardrails

Quickstart

Example of using the OpenAI Moderation Guardrail to verify a message:

import asyncio
from ragbits.guardrails.base import GuardrailManager, GuardrailVerificationResult
from ragbits.guardrails.openai_moderation import OpenAIModerationGuardrail


async def verify_message(message: str) -> list[GuardrailVerificationResult]:
    manager = GuardrailManager([OpenAIModerationGuardrail()])
    return await manager.verify(message)


if __name__ == '__main__':
    print(asyncio.run(verify_message("Test message")))

Documentation

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

ragbits_guardrails-1.7.0.dev202604280307.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file ragbits_guardrails-1.7.0.dev202604280307.tar.gz.

File metadata

File hashes

Hashes for ragbits_guardrails-1.7.0.dev202604280307.tar.gz
Algorithm Hash digest
SHA256 944b8e9c105be943239bea19bd1942eb5b6ca68ebffb6bcc2610dc3c13915259
MD5 aadbca8117f01b811c889d2369ae2968
BLAKE2b-256 f331e0bd500022c1e97e8ba4f4b52015c07afb6fd43d5fcd3c1dca3ce5fb9f5d

See more details on using hashes here.

File details

Details for the file ragbits_guardrails-1.7.0.dev202604280307-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_guardrails-1.7.0.dev202604280307-py3-none-any.whl
Algorithm Hash digest
SHA256 101da641830ffbbd3cb9decb88d7c0ec85dccf09fd5265d4b8ccec623bb16cca
MD5 0b1caeb57358a56bf3486b64a3c4fe2a
BLAKE2b-256 963e7975c7ec14335ff0a09af86a9223a10df3d4668669e153903c2266ce0f9d

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