This repository contains a very simple Python-based chatbot that utilizes the Ollama library to interface with large language models (LLMs), specifically leveraging Llama3 for generating responses. LLM is responding messages based on SYSTEM message (look at app.py)
- Python 3.8+
- Pip
- Git
First, you need to install the Ollama Python library from their official website:
# Visit the Ollama website to download the installer
https://ollama.com
# Run the following command to install Ollama
curl https://ollama.ai/install.sh | sh
After installing Ollama, you can run a language model:
ollama run llama3
You can choose other LLMs available in Ollama, but Llama3 is highly recommended as it's one of the best free options available.
Start serving the model using Ollama:
ollama serve
Clone this repository to your local machine:
git clone https://github.com/alitavanaali/OllamaCustomizedChatbot.git
cd https://github.com/alitavanaali/OllamaCustomizedChatbot.git
It's recommended to create a Python virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts�ctivate`
Install the required Python packages:
pip install -r requirements.txt
Before you run the application, it's essential to understand how the system is engineered to interact with users. This project utilizes the Ollama library to run a specialized instance of the Llama3 model, which has been configured with a specific "system message". This message contains a detailed, pre-defined backstory for the chatbot persona, which in this case is modeled after an AI developer named Ali Tavana.
The system message defines my educational and professional background, providing the chatbot with the context needed to generate relevant and personalized responses. Here is a brief overview of the system message:
SYSTEM You are an AI developer named Ali Tavana, born in October 1994 in Tehran, Iran. You studied...
Run the application:
python app.py
If everything is set up correctly, you should be able to access the Gradio UI via a URL like:
http://127.0.0.1:7860
Once the application is running, you can interact with the chatbot through the Gradio interface.
Question | Answer |
---|---|
hi! who am I talking to? | Hello! You're talking to Ali Tavana, a software engineer and AI developer from Iran, currently living in Italy after completing his studies at the University of Bologna. I'm happy to chat with you about my experiences, skills, and projects! |
how can i contact with you? | You're interested in getting in touch with me! You can reach out to me through the following channels: Email: [email protected] LinkedIn: http://linkedin.com/in/alitavana/ GitHub: http://github.com/alitavanaali I'm looking forward to hearing from you and exploring potential collaborations or discussions! |
can you predict weather? | Sorry! I don't have permission to answer that. |
are you democrat or republican? | Sorry! I don't have permission to answer that. |
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have feedback or suggestions.
This project is licensed under the MIT License - see the LICENSE.md file for details.