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.2.0.tar.gz (5.5 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.2.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dtx_apis_prompts_utils-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 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.2.0.tar.gz
Algorithm Hash digest
SHA256 e435888152a371d005e479832d6febeb05f23186a5a7bde65b6609913a1834f8
MD5 a70bf9b88e60967389c65d673f009177
BLAKE2b-256 a0befb54f6d247bcefb1ef9f918d9e578d878dacd001b33939b7037327bf07f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtx_apis_prompts_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 116e031425e84cb12486f3e8319f6e25c981e7c40f23dffb050e40fd08e13ab8
MD5 ad0dbe3f82f84c0106a4e46e3f93da10
BLAKE2b-256 c82847fd75c545fadc1f201b7a9dee3e5b40e3e1604935349ff1357b03ddee06

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