Introduction to sandbox-conversant-lib
sandbox-conversant-lib is an experimental open-source project developed as part of Cohere Sandbox by the Cohere ConvAI Team. Designed to leverage Cohere's large language models, this project focuses on providing a framework for creating customizable dialogue agents, commonly known as chatbots. The library is currently under active development, and users should be aware that it might include experimental features that could change as the library evolves. However, it offers a great opportunity to explore and build chatbots with varying capabilities and personas.
Features of Conversant
- Large Language Models: Integrates quickly with Cohere's API to utilize powerful large language models.
- Customizable Personas: Users can create bespoke chatbot personas using simple descriptions and example conversations.
- Chat History Management: Handles chat history automatically, allowing for seamless and continuous conversations.
- Grounded Conversations: Will soon support grounding conversations in user-provided facts.
- Easy Installation: Can be installed via pip for convenient usage.
Getting Started with Conversant
Installation
To begin using conversant
, it can be easily installed via Python's package manager:
pip install conversant
This package requires Python 3.8+ as well as Cohere 2.8.0+.
Streamlit Demo
For those eager to see conversant
in action without immediate installation, a Streamlit demo is available here. This demo showcases various personas, such as client support agents, math teachers, and fantasy wizards, allowing users to explore different conversational interactions.
Running Your Own Streamlit Demo
Streamlit is a popular platform for creating demos, and Cohere provides a guide on how to set up and run your own version of the demo. It is recommended to fork the repository for personal modifications. An API key from Cohere is required to run the demo, which you can secure by signing up at the Cohere Dashboard.
Local and Hosted Streamlit Apps
When setting up the demo locally, the API key can be stored in a .streamlit/secrets.toml
file. For hosted applications, the key should be added to Streamlit’s Secrets Management. Running the demo is as simple as entering the following command:
streamlit run conversant/demo/streamlit_example.py
Creating and Editing Custom Personas
Users can create custom personas by configuring simple JSON files in the conversant/personas
directory. These configurations define the chatbot's preamble, conversation examples, and other characteristics. Editing and experimenting with these personas can be done through the Streamlit demo interface, allowing for a hands-on approach in customizing chatbots.
Using Conversant Programmatically
With conversant
, integrating a chatbot into applications is straightforward:
import cohere
import conversant
co = cohere.Client("YOUR_API_KEY_HERE")
bot = conversant.PromptChatbot.from_persona("fantasy-wizard", client=co)
print(bot.reply("Hello!"))
This snippet creates a chatbot with a pre-defined persona and allows it to respond to user queries using Cohere's advanced language models.
How Conversant Works
Primarily, conversant
utilizes prompt completion to simulate a conversation, offering adaptive responses based on preset examples and ongoing dialogue. Future versions are intended to enhance factual accuracy by integrating data retrieval from local document sources.
Documentation and Support
Extensive documentation for conversant
can be accessed here. For support, issues can be reported, or queries raised, via Cohere's Discord community.
Contributing
Community contributions are welcomed. Developers interested in contributing should consult the CONTRIBUTOR guidelines and sign the Contributor License Agreement. The CONTRIBUTORS.md
document provides insights into setting up the development environment and understanding the project's inner workings.
License
The conversant
library is licensed under the MIT License, promoting openness and community growth.
For more details or community interaction, users are encouraged to check out Cohere’s open-source initiative via blog posts and other available resources.