langchain/templates/sql-llamacpp
2023-10-27 10:34:00 -07:00
..
sql_llamacpp LLaMA2 with JSON schema support template (#12435) 2023-10-27 10:34:00 -07:00
tests Templates (#12294) 2023-10-25 18:47:42 -07:00
nba_roster.db Templates (#12294) 2023-10-25 18:47:42 -07:00
poetry.lock Templates (#12294) 2023-10-25 18:47:42 -07:00
pyproject.toml Templates (#12294) 2023-10-25 18:47:42 -07:00
README.md Templates (#12294) 2023-10-25 18:47:42 -07:00

SQL with LLaMA2 using Ollama

This template allows you to chat with a SQL database in natural language in private, using an open source LLM.

LLama.cpp

Enviorment

From here and here.

wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
bash Miniforge3-MacOSX-arm64.sh
conda create -n llama python=3.9.16
conda activate /Users/rlm/miniforge3/envs/llama
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install -U llama-cpp-python --no-cache-dir

LLM

It will download Mistral-7b model from here.

You can select other files and specify their download path (browse here).

Set up SQL DB

This template includes an example DB of 2023 NBA rosters.

You can see instructions to build this DB here.

Installation

# from inside your LangServe instance
poe add sql/llama2-ollama