This ActiBot-Powered Liferay Agent Chat App enables users to interact with an intelligent agent to perform various tasks like creating websites, managing users, and retrieving user lists. The app leverages a large language model and custom tools to handle user queries and execute predefined tool-based actions seamlessly across multiple platforms via API integration.
- ActiBot allows users to interact conversationally and perform real-world tasks such as:
- Creating Websites
- Creating Users
- Fetching User Lists
- ActiBot integrates with powerful tools through Langchain to perform specific tasks:
CreateWebsiteTool
: Assists in creating websites using user-defined parameters.CreateUserTool
: Creates users based on provided schemas.GetUserListTool
: Retrieves user lists from predefined data sources.
- Every conversation is tied to a unique session ID, which preserves the chat history. This enables users to resume conversations from where they left off in previous sessions.
- The agent's interactions are managed by a flexible prompt template (
ChatPromptTemplate
), ensuring consistency and adaptability in responses and tool usage.
- A clean and user-friendly web interface built with Streamlit, allowing users to input queries, receive responses, and visualize chat history.
- A sidebar provides additional functionality and application information.
- The app uses the
RunnableWithMessageHistory
component from Langchain to dynamically manage and store chat histories, enabling the agent to retrieve past conversations and provide a more personalized experience.
Follow these steps to install and run the ActiBot-Powered Liferay Agent Chat App on your local machine.
- Python 3.8 or higher
- API key for the required language model (stored in
.streamlit/secrets.toml
file)
git clone https://github.com/tech-rakesh-ai/ActiBot-Agent-Chat-App.git
cd ActiBot-Agent-Chat-App
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
Install the required dependencies from requirements.txt
:
pip install -r requirements.txt
Ensure your requirements.txt
includes the following:
streamlit
langchain
python-dotenv
Instead of using a .env
file, you will configure the necessary credentials in the secrets.toml
file located in the .streamlit
directory. Create the file .streamlit/secrets.toml
and add the following:
# ActiBot API Key
GROQ_API_KEY = "your-groq-api-key"
# Liferay Credentials
LIFERAY_BASE_URL = "https://your-liferay-instance.com"
USERNAME = "your-username"
PASSWORD = "your-password"
Replace your-groq-api-key
, https://your-liferay-instance.com
, your-username
, and your-password
with the appropriate values.
To start the Streamlit app, use the following command:
streamlit run app.py
The app will open in your default web browser, and you can begin interacting with the agent.
- Start a Conversation: Use the input box at the bottom of the page to submit a query or request.
- Tool Execution: Ask ActiBot to perform tasks such as creating a website, managing users, or retrieving a user list.
- View Responses: The agent will respond with relevant answers or perform requested actions.
- Session Continuity: ActiBot retains chat history within the session, so you can review previous interactions or resume the conversation seamlessly.
- Creating a website: "Please create a website for my business."
- Creating a user: "Add a new user named John Doe."
- Fetching user list: "Can you retrieve the list of users?"
actibot-agent-chat-app/
│
├── app.py # Main Streamlit app code
├── requirements.txt # Python dependencies
├── tools_prompts.py # Prompts for tools
├── tools_functions.py # Tool function implementations
├── tools_schemas.py # Schemas for tool inputs
├── display_sidebar.py # Sidebar layout functions
├── display_conversation.py # Functions to display chat history
└── .streamlit/
└── secrets.toml # Secrets for API keys and credentials
- ActiBot & Langchain: Uses the language model integrated with Langchain for generating responses and handling queries.
- Tool Calling Agent: ActiBot can call specific tools like
CreateWebsiteTool
,CreateUserTool
, andGetUserListTool
based on user commands. - Chat History: Chat sessions track and maintain conversation history using
ChatMessageHistory
.
- Additional Tool Integrations: More advanced tools for automating complex workflows and actions.
- Multi-Turn Conversation Handling: Allow the agent to handle more nuanced conversations, retaining detailed memory across turns.
- Enhanced UI: Add customizable UI elements such as themes, settings, and widgets for richer user interactions.
Developed by Rakesh Kumar.
Feel free to connect with me on LinkedIn for feedback or to discuss future improvements.
MIT License © 2024 ActiBot-Powered Liferay Agent Chat App.