Experiment with Langchain to build converational RAG Q&A application.
The application can use any LLM that can be hosted by OpenAI compatible API server.
- Edit
config.yamlby setopenai_api_keyto OpenAI API key, and remove valueopenai_compatible_base_url(make it empty value). - From root directory of the project, run
docker compose -f docker/docker-compose.yaml up -d. - Access the web via port 8501 (you can edit the port mapping in
docker/docker-compose.yaml).
- Download
.ggufmodel from Hugging Face. I use bartowski/Meta-Llama-3.1-8B-Instruct-GGUF Q6_K_L model, and put it inmodelsdirectory. - Edit
docker/docker-compose.llama-cpp.yamlfile to config how llama.cpp server run as follow.- In
imageattribute, set it to image version you want to use. I build it locally, so I uselocal/llama.cpp:server-cuda. Generally, the server image is enough for running e.g.ghcr.io/ggerganov/llama.cpp:server - In
volumesattribute, add bind mount as necessary to add document to use for RAG. - In
commandattribute, changeMeta-Llama-3.1-8B-Instruct-Q6_K_L.ggufto the model name that you download intomodelsdirectory. - In
commandattribute, change any necessary you want to config the server.
- In
- In
docker/docker-compose.yamlfile, editvolumesattribute to add bind mount as necessary to add document to use for RAG. - Edit
config.yamlfile to config how the app run as follow- Set
openai_api_keyto any string (but not empty string). - Set
openai_compatible_base_urltohttp://llama-cpp-server:8000. - Set
document_pathto the path of the document that you add to bind mount.
- Set
- From root directory of the project, run
docker compose -f docker/docker-compose.yaml -f docker/docker-compose.llama-cpp.yaml up -d.