This project implements a local AI assistant using:
- Ollama local model operation via
ollama.chat - Python Flask API exposing OpenAI-compatible endpoints
- Compatibility with AnythingLLM chat clients
- Assistant role design through
assistant_config.pySYSTEM_PROMPT
- Install dependencies:
pip install -r requirements.txt- Make sure Ollama is installed and the model exists locally, e.g.:
ollama models- Optionally edit
assistant_config.pyto change:
MODEL_NAMEOLLAMA_OPTIONSSYSTEM_PROMPT- Web search settings
python main.pyThe server will start on http://127.0.0.1:8000.
In AnythingLLM, point the chat endpoint to:
- URL:
http://127.0.0.1:8000/v1/chat/completions - Model:
llama3.2(or the value inassistant_config.py)
AnythingLLM can send messages in OpenAI-compatible format, and this API preserves conversation history and returns assistant responses.
Customize the assistant role in assistant_config.py by editing SYSTEM_PROMPT.
Example:
SYSTEM_PROMPT = """
You are a friendly Taiwan Travel Assistant for international students.
..."""This prompt defines the assistant's behavior, tone, language rules, and response style.