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.4.0.dev202602261352.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.

File details

Details for the file ragbits_guardrails-1.4.0.dev202602261352.tar.gz.

File metadata

File hashes

Hashes for ragbits_guardrails-1.4.0.dev202602261352.tar.gz
Algorithm Hash digest
SHA256 f569fc3299bcbdb20629d09a6fddb9a70db321088d883615b62845082efecdf3
MD5 173d0296bbb5dd4ddbfafe17c85d0805
BLAKE2b-256 81257513e86fab741503a8498ca9d58161a41de464bb58b24f8f75667b509ea0

See more details on using hashes here.

File details

Details for the file ragbits_guardrails-1.4.0.dev202602261352-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_guardrails-1.4.0.dev202602261352-py3-none-any.whl
Algorithm Hash digest
SHA256 24441311834f431c24f48b2709a2c7e6bc0207d5afb78236466de0f90fdc2ce6
MD5 0eb1e617fb14c38df444a94bbb53e581
BLAKE2b-256 81ad878341e0dc7ba24aa9887a29a76eec926f669227ae6f796c994d7b734be3

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