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, andASSISTANT. - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dtx_apis_prompts_utils-0.2.1.tar.gz.
File metadata
- Download URL: dtx_apis_prompts_utils-0.2.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.11.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b9d64e65ebd9122b52173719a246920b1d4846a6b701d12aa124f62a6c42f84
|
|
| MD5 |
a29ce7df5c4b3784976f84d9a4ce3edb
|
|
| BLAKE2b-256 |
085765f6a8470df021feefd89917d5c18aad436cbe584be49eb439af273f57f4
|
File details
Details for the file dtx_apis_prompts_utils-0.2.1-py3-none-any.whl.
File metadata
- Download URL: dtx_apis_prompts_utils-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.11.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a9b6529fd59cc144518033248e6b5a4d3d7aabb4115ad2aa5492597cf849e6
|
|
| MD5 |
7f4b50ab33e635f85fb2e0be8543a7aa
|
|
| BLAKE2b-256 |
37e60bfd4e83aa7405305a696e9e1594ca6580fa3c9b7362fd3eff11ef6f9e6b
|