Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A Python package designed to manage complex, threaded conversations with branching capabilities, much like version control systems manage code branches.
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.
You can install DialogicAI directly from PyPI using pip:
pip install dialogic-ai
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)
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.
content
, role
, and optional metadata
(such as branches).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.
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.
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.
conversation_list = dialogicAI.thread_to_list()
print(conversation_list)
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:
git checkout -b feature-branch
to start working on a new feature or bug fix.git commit -am 'Add new feature'
).git push origin feature-branch
.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:
FAQs
A Python package designed to manage complex, threaded conversations with branching capabilities, much like version control systems manage code branches.
We found that dialogic-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.