Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(devcontainer): add llama cli/api #109

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Uncomment the following line to use the mocked API
#VITE_API_BASE=http://localhost:5174
# Uncomment the following line to use the llama or mocked API
VITE_API_BASE=http://localhost:5174

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ dist-ssr
*.sln
*.sw?
*.env

# llama-api
models
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ git subtree pull --prefix src/awesome-chatgpt-prompts https://github.com/f/aweso
docker compose up -d
```

## Llama api
If you want to use local/offline models using llama.cpp, you can use llama-cpp-python API instead.

To use the llama API:
- Copy your models in the root of the project in a folder called `models`.
- Edit the `docker-compose.yml` file at the root of the project and uncomment the `llama-api` service and the `depends-on` in the chatgpt-web service.
- Edit the `.env` file at root of the project and uncommentt the key `VITE_API_BASE=http://localhost:5174` in it. You will also need to alter the name of the model path to point to the model you wish to use.
- Run the `docker compose up -d` command above.

## Mocked api
If you don't want to wait for the API to respond, you can use the mocked API instead. To use the mocked API, edit the `.env` file at root of the project ans set the key `VITE_API_BASE=http://localhost:5174` in it. Then, run the `docker compose up -d` command above.

Expand Down
25 changes: 17 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
container_name: chatgpt_web
restart: always
depends_on:
- mocked_api
# - mocked_api
- llama_api
env_file:
- .env
ports:
Expand All @@ -16,11 +17,19 @@ services:
context: "."
dockerfile: Dockerfile

mocked_api:
container_name: mocked_api
build:
context: "."
dockerfile: mocked_api/Dockerfile-mockapi
restart: always
# mocked_api:
# container_name: mocked_api
# build:
# context: "."
# dockerfile: mocked_api/Dockerfile-mockapi
# restart: always
# ports:
# - 5174:5174

llama_api:
image: quay.io/go-skynet/llama-cli:latest
ports:
- 5174:5174
- 5174:8080
volumes:
- ./models/:/models:cached
command: api --context-size 700 --threads 10 --models-path /models/7B --default-model /models/7B/ggml-vicuna-7b-4bit.bin