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.0.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.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dtx_apis_prompts_utils-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 40a47032c5cf95fddafadd1cf11e923ec08ae5487a2fb6a1481d5bec4ec494cb
MD5 6e25aad998e2b36821d1095e0584cfec
BLAKE2b-256 5cd2aff0be17828900aeaf141a6c6b7ca1a0fb4f61f02f066fb190fdb895c751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtx_apis_prompts_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38cfb83c2a3d1d8958c98384ec6efda710dfb7da7df1cb9b0544d587049d708b
MD5 7d6cf0b7b444c12eca70bb3cc37ef4b3
BLAKE2b-256 829ed29d9ff3eca3a59d6ba69872ae6299b0a7f46e8cfb3867904c4285994b84

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