Skip to content

Commit f457101

Browse files
committed
Merge remote-tracking branch 'origin/main' into j_main
2 parents 75e02b3 + cf61bf7 commit f457101

37 files changed

+3578
-2672
lines changed

.github/workflows/actions/install_dependencies/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
poetry_version:
99
required: true
1010
type: string
11-
default: "1.5.1"
11+
default: "1.8.3"
1212

1313
runs:
1414
using: composite

Dockerfile.external

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:3.11.6-slim-bookworm as base
33
# Install poetry
44
RUN pip install pipx
55
RUN python3 -m pipx ensurepath
6-
RUN pipx install poetry
6+
RUN pipx install poetry==1.8.3
77
ENV PATH="/root/.local/bin:$PATH"
88
ENV PATH=".venv/bin/:$PATH"
99

@@ -14,27 +14,38 @@ FROM base as dependencies
1414
WORKDIR /home/worker/app
1515
COPY pyproject.toml poetry.lock ./
1616

17-
RUN poetry install --extras "ui vector-stores-qdrant llms-ollama embeddings-ollama"
17+
ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama"
18+
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
1819

1920
FROM base as app
20-
2121
ENV PYTHONUNBUFFERED=1
2222
ENV PORT=8080
23+
ENV APP_ENV=prod
24+
ENV PYTHONPATH="$PYTHONPATH:/home/worker/app/private_gpt/"
2325
EXPOSE 8080
2426

2527
# Prepare a non-root user
26-
RUN adduser --system worker
28+
# More info about how to configure UIDs and GIDs in Docker:
29+
# https://github.com/systemd/systemd/blob/main/docs/UIDS-GIDS.md
30+
31+
# Define the User ID (UID) for the non-root user
32+
# UID 100 is chosen to avoid conflicts with existing system users
33+
ARG UID=100
34+
35+
# Define the Group ID (GID) for the non-root user
36+
# GID 65534 is often used for the 'nogroup' or 'nobody' group
37+
ARG GID=65534
38+
39+
RUN adduser --system --gid ${GID} --uid ${UID} --home /home/worker worker
2740
WORKDIR /home/worker/app
2841

29-
RUN mkdir local_data; chown worker local_data
30-
RUN mkdir models; chown worker models
42+
RUN chown worker /home/worker/app
43+
RUN mkdir local_data && chown worker local_data
44+
RUN mkdir models && chown worker models
3145
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
3246
COPY --chown=worker private_gpt/ private_gpt
33-
COPY --chown=worker fern/ fern
34-
COPY --chown=worker *.yaml *.md ./
47+
COPY --chown=worker *.yaml .
3548
COPY --chown=worker scripts/ scripts
3649

37-
ENV PYTHONPATH="$PYTHONPATH:/private_gpt/"
38-
3950
USER worker
40-
ENTRYPOINT python -m private_gpt
51+
ENTRYPOINT python -m private_gpt

Dockerfile.local

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM python:3.11.6-slim-bookworm as base
55
# Install poetry
66
RUN pip install pipx
77
RUN python3 -m pipx ensurepath
8-
RUN pipx install poetry
8+
RUN pipx install poetry==1.8.3
99
ENV PATH="/root/.local/bin:$PATH"
1010
ENV PATH=".venv/bin/:$PATH"
1111

@@ -24,28 +24,39 @@ FROM base as dependencies
2424
WORKDIR /home/worker/app
2525
COPY pyproject.toml poetry.lock ./
2626

27-
RUN poetry install --extras "ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
27+
ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
28+
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
2829

2930
FROM base as app
3031

3132
ENV PYTHONUNBUFFERED=1
3233
ENV PORT=8080
34+
ENV APP_ENV=prod
35+
ENV PYTHONPATH="$PYTHONPATH:/home/worker/app/private_gpt/"
3336
EXPOSE 8080
3437

3538
# Prepare a non-root user
36-
RUN adduser --group worker
37-
RUN adduser --system --ingroup worker worker
39+
# More info about how to configure UIDs and GIDs in Docker:
40+
# https://github.com/systemd/systemd/blob/main/docs/UIDS-GIDS.md
41+
42+
# Define the User ID (UID) for the non-root user
43+
# UID 100 is chosen to avoid conflicts with existing system users
44+
ARG UID=100
45+
46+
# Define the Group ID (GID) for the non-root user
47+
# GID 65534 is often used for the 'nogroup' or 'nobody' group
48+
ARG GID=65534
49+
50+
RUN adduser --system --gid ${GID} --uid ${UID} --home /home/worker worker
3851
WORKDIR /home/worker/app
3952

40-
RUN mkdir local_data; chown worker local_data
41-
RUN mkdir models; chown worker models
53+
RUN chown worker /home/worker/app
54+
RUN mkdir local_data && chown worker local_data
55+
RUN mkdir models && chown worker models
4256
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
4357
COPY --chown=worker private_gpt/ private_gpt
44-
COPY --chown=worker fern/ fern
45-
COPY --chown=worker *.yaml *.md ./
58+
COPY --chown=worker *.yaml ./
4659
COPY --chown=worker scripts/ scripts
4760

48-
ENV PYTHONPATH="$PYTHONPATH:/private_gpt/"
49-
5061
USER worker
5162
ENTRYPOINT python -m private_gpt

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
[![Tests](https://github.com/zylon-ai/private-gpt/actions/workflows/tests.yml/badge.svg)](https://github.com/zylon-ai/private-gpt/actions/workflows/tests.yml?query=branch%3Amain)
44
[![Website](https://img.shields.io/website?up_message=check%20it&down_message=down&url=https%3A%2F%2Fdocs.privategpt.dev%2F&label=Documentation)](https://docs.privategpt.dev/)
5-
65
[![Discord](https://img.shields.io/discord/1164200432894234644?logo=discord&label=PrivateGPT)](https://discord.gg/bK6mRVpErU)
76
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZylonPrivateGPT)](https://twitter.com/ZylonPrivateGPT)
87

9-
10-
> Install & usage docs: https://docs.privategpt.dev/
11-
>
12-
> Join the community: [Twitter](https://twitter.com/ZylonPrivateGPT) & [Discord](https://discord.gg/bK6mRVpErU)
13-
148
![Gradio UI](/fern/docs/assets/ui.png?raw=true)
159

1610
PrivateGPT is a production-ready AI project that allows you to ask questions about your documents using the power
1711
of Large Language Models (LLMs), even in scenarios without an Internet connection. 100% private, no data leaves your
1812
execution environment at any point.
1913

14+
>[!TIP]
15+
> If you are looking for an **enterprise-ready, fully private AI workspace**
16+
> check out [Zylon's website](https://zylon.ai) or [request a demo](https://cal.com/zylon/demo?source=pgpt-readme).
17+
> Crafted by the team behind PrivateGPT, Zylon is a best-in-class AI collaborative
18+
> workspace that can be easily deployed on-premise (data center, bare metal...) or in your private cloud (AWS, GCP, Azure...).
19+
2020
The project provides an API offering all the primitives required to build private, context-aware AI applications.
2121
It follows and extends the [OpenAI API standard](https://openai.com/blog/openai-api),
2222
and supports both normal and streaming responses.
@@ -38,13 +38,10 @@ In addition to this, a working [Gradio UI](https://www.gradio.app/)
3838
client is provided to test the API, together with a set of useful tools such as bulk model
3939
download script, ingestion script, documents folder watch, etc.
4040

41-
> 👂 **Need help applying PrivateGPT to your specific use case?**
42-
> [Let us know more about it](https://forms.gle/4cSDmH13RZBHV9at7)
43-
> and we'll try to help! We are refining PrivateGPT through your feedback.
44-
4541
## 🎞️ Overview
46-
DISCLAIMER: This README is not updated as frequently as the [documentation](https://docs.privategpt.dev/).
47-
Please check it out for the latest updates!
42+
>[!WARNING]
43+
> This README is not updated as frequently as the [documentation](https://docs.privategpt.dev/).
44+
> Please check it out for the latest updates!
4845
4946
### Motivation behind PrivateGPT
5047
Generative AI is a game changer for our society, but adoption in companies of all sizes and data-sensitive

docker-compose.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ services:
55
volumes:
66
- ./local_data/:/home/worker/app/local_data
77
ports:
8-
- 8001:8080
8+
- 8001:8001
99
environment:
10-
PORT: 8080
10+
PORT: 8001
1111
PGPT_PROFILES: docker
1212
PGPT_MODE: ollama
13+
PGPT_EMBED_MODE: ollama
1314
ollama:
1415
image: ollama/ollama:latest
16+
ports:
17+
- 11434:11434
1518
volumes:
1619
- ./models:/root/.ollama

fern/docs.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,16 @@ navigation:
7474
path: ./docs/pages/ui/gradio.mdx
7575
- page: Alternatives
7676
path: ./docs/pages/ui/alternatives.mdx
77-
# Small code snippet or example of usage to help users
7877
- tab: recipes
7978
layout:
80-
- section: Choice of LLM
79+
- section: Getting started
80+
contents:
81+
- page: Quickstart
82+
path: ./docs/pages/recipes/quickstart.mdx
83+
- section: General use cases
8184
contents:
82-
# TODO: add recipes
83-
- page: List of LLMs
84-
path: ./docs/pages/recipes/list-llm.mdx
85+
- page: Summarize
86+
path: ./docs/pages/recipes/summarize.mdx
8587
# More advanced usage of PrivateGPT, by API
8688
- tab: api-reference
8789
layout:

fern/docs/assets/ui.png

-57.8 KB
Loading

fern/docs/pages/installation/installation.mdx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ pyenv local 3.11
2828
Install [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) for dependency management:
2929
Follow the instructions on the official Poetry website to install it.
3030

31+
<Callout intent="warning">
32+
A bug exists in Poetry versions 1.7.0 and earlier. We strongly recommend upgrading to a tested version.
33+
To upgrade Poetry to latest tested version, run `poetry self update 1.8.3` after installing it.
34+
</Callout>
35+
3136
### 4. Optional: Install `make`
3237
To run various scripts, you need to install `make`. Follow the instructions for your operating system:
3338
#### macOS
@@ -130,16 +135,20 @@ Go to [ollama.ai](https://ollama.ai/) and follow the instructions to install Oll
130135

131136
After the installation, make sure the Ollama desktop app is closed.
132137

133-
Install the models to be used, the default settings-ollama.yaml is configured to user `mistral 7b` LLM (~4GB) and `nomic-embed-text` Embeddings (~275MB). Therefore:
134-
138+
Now, start Ollama service (it will start a local inference server, serving both the LLM and the Embeddings):
135139
```bash
136-
ollama pull mistral
137-
ollama pull nomic-embed-text
140+
ollama serve
138141
```
139142

140-
Now, start Ollama service (it will start a local inference server, serving both the LLM and the Embeddings):
143+
Install the models to be used, the default settings-ollama.yaml is configured to user llama3.1 8b LLM (~4GB) and nomic-embed-text Embeddings (~275MB)
144+
145+
By default, PGPT will automatically pull models as needed. This behavior can be changed by modifying the `ollama.autopull_models` property.
146+
147+
In any case, if you want to manually pull models, run the following commands:
148+
141149
```bash
142-
ollama serve
150+
ollama pull llama3.1
151+
ollama pull nomic-embed-text
143152
```
144153

145154
Once done, on a different terminal, you can install PrivateGPT with the following command:

fern/docs/pages/installation/troubleshooting.mdx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,26 @@ PrivateGPT uses the `AutoTokenizer` library to tokenize input text accurately. I
2424
In your `settings.yaml` file, specify the model you want to use:
2525
```yaml
2626
llm:
27-
tokenizer: mistralai/Mistral-7B-Instruct-v0.2
27+
tokenizer: meta-llama/Meta-Llama-3.1-8B-Instruct
2828
```
2929
2. **Set Access Token for Gated Models:**
3030
If you are using a gated model, ensure the `access_token` is set as mentioned in the previous section.
31-
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.
31+
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.
32+
33+
# Embedding dimensions mismatch
34+
If you encounter an error message like `Embedding dimensions mismatch`, it is likely due to the embedding model and
35+
current vector dimension mismatch. To resolve this issue, ensure that the model and the input data have the same vector dimensions.
36+
37+
By default, PrivateGPT uses `nomic-embed-text` embeddings, which have a vector dimension of 768.
38+
If you are using a different embedding model, ensure that the vector dimensions match the model's output.
39+
40+
<Callout intent = "warning">
41+
In versions below to 0.6.0, the default embedding model was `BAAI/bge-small-en-v1.5` in `huggingface` setup.
42+
If you plan to reuse the old generated embeddings, you need to update the `settings.yaml` file to use the correct embedding model:
43+
```yaml
44+
huggingface:
45+
embedding_hf_model_name: BAAI/bge-small-en-v1.5
46+
embedding:
47+
embed_dim: 384
48+
```
49+
</Callout>

fern/docs/pages/manual/ingestion.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ The ingestion of documents can be done in different ways:
88

99
## Bulk Local Ingestion
1010

11+
You will need to activate `data.local_ingestion.enabled` in your setting file to use this feature. Additionally,
12+
it is probably a good idea to set `data.local_ingestion.allow_ingest_from` to specify which folders are allowed to be ingested.
13+
14+
<Callout intent = "warning">
15+
Be careful enabling this feature in a production environment, as it can be a security risk, as it allows users to
16+
ingest any local file with permissions.
17+
</Callout>
18+
1119
When you are running PrivateGPT in a fully local setup, you can ingest a complete folder for convenience (containing
1220
pdf, text files, etc.)
1321
and optionally watch changes on it with the command:

0 commit comments

Comments
 (0)