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

This version

1.2.1

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.2.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

ragbits_guardrails-1.2.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file ragbits_guardrails-1.2.1.tar.gz.

File metadata

  • Download URL: ragbits_guardrails-1.2.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ragbits_guardrails-1.2.1.tar.gz
Algorithm Hash digest
SHA256 6e49e89afe2f252d4812c338050c4a55d87b136525952aa2cbbb95ac4282e9ec
MD5 c54f5c4adbb023185ada2851a4d29097
BLAKE2b-256 3d17e1d3f6c9ce6e7aa3a3cda00ce8f53275f0fc6aacfdb2eda7ec1d29312318

See more details on using hashes here.

File details

Details for the file ragbits_guardrails-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_guardrails-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a07cb9795ff8f5ca42615d31f6083769ce0b357c953ffbb61aa3a8ceb59cf559
MD5 061c5a9767162d9850efa22bb077a4ed
BLAKE2b-256 4d112df283c7148ec976306bde68d443fb3813e24f0ec80d7d51c15c34427f39

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