- Create and activate a virtual environment
python3 -m venv .venv && source .venv/bin/activate
- Install all requirements
pip install -r requirements.txt
- Train the model using the
Ollama
ollama create <your-model-name> -f Modelfile
- Check and use the created model in the
app.pyfile
- Check if the model is created successfully:
ollama list
- Use the model in the
app.pyfile:
model = Ollama(model="<your-model-name>")- Run the app using
chainlit
chainlit run app.py
- Optional: (Need connecting to the internet) You can create a database named "LocalGPT" to store the user inputs and chat responses on
Langchain. Rename the fileexample.envto.envand add the following environment variables:
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_API_KEY="<your-api-key>"
LANGCHAIN_PROJECT="LocalGPT"