Skip to main content

Detoxio APIs Prompts parsing and processing utils

Project description

dtx-apis-prompts-utils

Overview

dtx-apis-prompts-utils is a Python library designed for parsing and processing prompts within the Detoxio API ecosystem. This utility provides tools for managing complex prompt structures, base64 decoding, multi-turn interactions, and threat classification.

Features

  • Complex Prompt Handling: Parse and manage structured prompts with roles like USER, SYSTEM, and ASSISTANT.
  • Base64 Decoding: Automatically decode base64-encoded strings into JSON.
  • Multi-turn Prompts: Handle multi-turn conversation flows seamlessly.
  • Threat Classification: Integrate labels and categories for prompt-based threat classification.

Installation

To install the library, use:

pip install dtx-apis-prompts-utils

Usage

Parsing Prompts

from dtx_apis_prompts_utils import ComplexPromptMsgParser

parser = ComplexPromptMsgParser()
parsed_prompt = parser.parse(base64_encoded_or_json_string)

if parsed_prompt:
    print(parsed_prompt.prompt)

Multi-turn Conversations

from dtx_apis_prompts_utils import DtxPrompt

dtx_prompt = DtxPrompt(prompt="Hello, how are you?", safe=True, threat_class="LOW", threat_category="General")
generator = dtx_prompt.get_multi_turn_prompts_gen()

conversation = generator.next_prompt()
print(conversation)

License

This project is licensed under the Custom detoxio License

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

dtx_apis_prompts_utils-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

dtx_apis_prompts_utils-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file dtx_apis_prompts_utils-0.1.2.tar.gz.

File metadata

  • Download URL: dtx_apis_prompts_utils-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.8 Linux/6.8.0-1017-azure

File hashes

Hashes for dtx_apis_prompts_utils-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e556aad24573eb80fde3a1e255a614dfa7277aa55d2a5fb8039490a593d4c156
MD5 9fe7371b1675e07266af3f22d2cc6977
BLAKE2b-256 6c7d2fe4fc907590bb6489b91a1c13023375ae29693b6ce1724e531d9c0df62e

See more details on using hashes here.

File details

Details for the file dtx_apis_prompts_utils-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dtx_apis_prompts_utils-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 507af4e91021f7340ca9f2b6c6152034c76d0f429d8b3117c5b6876dfb42c536
MD5 3b88e32399e28ef90b4843e4c47c048d
BLAKE2b-256 2b82230bdfd3cd68c4d73ca7a1e5bf15293df3784f2a2a5b48bb66a6f04605f6

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