Skip to main content

A Python package designed to manage complex, threaded conversations with branching capabilities, much like version control systems manage code branches.

Project description

🎉 DialogicAI

DialogicAI is a Python package designed to manage complex, threaded conversations with branching capabilities, much like version control systems manage code branches. Whether you're building an AI chatbot, a customer support system, or any application that requires structured conversations, DialogicAI provides the tools to seamlessly manage multiple conversation threads, switch between branches, and keep track of message history.

🚀 Installation

You can install DialogicAI directly from PyPI using pip:

pip install dialogic-ai

🏃‍♂️ Quick Start

Here’s a quick example to get you started with DialogicAI:

from dialogicai.core import DialogicAI

# Initialize the DialogicAI instance
dialogicAI = DialogicAI()

# Add some messages
dialogicAI.add_message({"content": "Hello, how are you?", "role": "user"})
dialogicAI.add_message({"content": "I'm doing well, thank you! How can I assist you today?", "role": "assistant"})

# Branch the conversation
dialogicAI.add_message({
    "content": "Can you tell me a joke?", 
    "role": "user",
    "metadata": {"branches": ["joke"]}
})

# Convert the thread to a list of dictionaries
conversation = dialogicAI.thread_to_list()
print(conversation)

🛠️ Main Methods

DialogicAI provides a set of powerful methods to help you manage conversation threads with ease. Here are some of the key methods:

add_message(message)

This method adds a new message to the current conversation thread.

  • Parameters:

    • message (dict): A dictionary containing the message's content, role, and optional metadata (such as branches).
  • Usage Example:

    dialogicAI.add_message({"content": "Hello, how are you?", "role": "user"})
    

🔄 change_branch(branch)

Switches the current conversation to a different branch, allowing you to manage multiple threads seamlessly.

  • Parameters:

    • branch (str): The name of the branch you wish to switch to.
  • Usage Example:

    dialogicAI.change_branch("joke")
    

📩 get_last_message()

Retrieves the last message in the current branch, making it easy to continue a conversation or review the last interaction.

  • Returns:

    • NodeMessage: The last message object in the current branch.
  • Usage Example:

    last_message = dialogicAI.get_last_message()
    print(last_message.content)
    

📝 thread_to_list()

Converts the entire conversation thread into a list of dictionaries, making it straightforward to serialize or inspect the conversation history.

  • Returns:

    • list: A list of dictionaries, each representing a message in the thread.
  • Usage Example:

    conversation_list = dialogicAI.thread_to_list()
    print(conversation_list)
    

🤝 Contributions

We welcome contributions from the community! If you have ideas for new features, find bugs, or want to enhance the code, feel free to get involved. Here’s how you can contribute:

  1. 🍴 Fork the repository: Create your own copy of the project.
  2. 🌿 Create a new branch: Use git checkout -b feature-branch to start working on a new feature or bug fix.
  3. 💻 Commit your changes: Once your changes are ready, commit them with a meaningful message (git commit -am 'Add new feature').
  4. 📤 Push to the branch: Push your changes to your GitHub repository with git push origin feature-branch.
  5. 🔄 Open a Pull Request: Submit your changes for review, and if approved, they’ll be merged into the project!

📐 Coding Standards

  • We use Black for code formatting to ensure consistency across the codebase.
  • All contributions should include relevant pytest tests to maintain code quality.

📬 Contact

I’m an AI Engineer with a passion for developing flawless products. Feel free to reach out if you have any questions, ideas, or just want to connect:

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

dialogic_ai-0.0.5.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

dialogic_ai-0.0.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file dialogic_ai-0.0.5.tar.gz.

File metadata

  • Download URL: dialogic_ai-0.0.5.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for dialogic_ai-0.0.5.tar.gz
Algorithm Hash digest
SHA256 756b95f94375c6cdc87fc4e9e7290831fc6785763cf37b8d7a0bf261ad29353b
MD5 9f96586173ed15221c47115de1642509
BLAKE2b-256 8054d8c23199d603a8d6acdc04c43ba235d6606df420f25e48e44b69aaedfb87

See more details on using hashes here.

File details

Details for the file dialogic_ai-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: dialogic_ai-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for dialogic_ai-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e515e8a6cc3af6338db934fe9955c2d565fa872809c56567887896b71a5825
MD5 14516ae477a4044843a0fbd426ef8149
BLAKE2b-256 697bebd32a0cd23f4d0840175fdc3eb787911abc3b928f91975c7a62c037aacc

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