Skip to content

Commit ddd75b1

Browse files
committed
Added VECTOR_DB_INDEX environment variable for overriding the Faiss database index
1 parent 5493558 commit ddd75b1

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

byok/Containerfile.output

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ ARG BYOK_TOOL_IMAGE=quay.io/$USERNAME/tool:latest
22
ARG UBI_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:latest
33
FROM ${BYOK_TOOL_IMAGE} as tool
44
ARG UBI_BASE_IMAGE
5+
ARG VECTOR_DB_INDEX=vector_db_index
56

67
USER 0
78
WORKDIR /workdir
89

10+
ENV VECTOR_DB_INDEX=$VECTOR_DB_INDEX
911
RUN python3.11 generate_embeddings_tool.py -i /markdown -emd embeddings_model \
10-
-emn sentence-transformers/all-mpnet-base-v2 -o vector_db -id vector_db_index
12+
-emn sentence-transformers/all-mpnet-base-v2 -o vector_db -id $VECTOR_DB_INDEX
1113

1214
FROM ${UBI_BASE_IMAGE}
1315
COPY --from=tool /workdir/vector_db /rag/vector_db

byok/Containerfile.tool

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARG UBI_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:latest
33
FROM ${UBI_BASE_IMAGE}
44
ARG LOG_LEVEL=info
55
ARG OUT_IMAGE_TAG=byok-image
6+
ARG VECTOR_DB_INDEX=vector_db_index
67
ARG BYOK_TOOL_IMAGE
78
ARG UBI_BASE_IMAGE
89
RUN dnf install -y buildah python3.11 python3.11-pip wget
@@ -25,7 +26,9 @@ ENV OUT_IMAGE_TAG=$OUT_IMAGE_TAG
2526
ENV BYOK_TOOL_IMAGE=$BYOK_TOOL_IMAGE
2627
ENV UBI_BASE_IMAGE=$UBI_BASE_IMAGE
2728
ENV LOG_LEVEL=$LOG_LEVEL
29+
ENV VECTOR_DB_INDEX=$VECTOR_DB_INDEX
2830
CMD buildah --log-level $LOG_LEVEL build --build-arg BYOK_TOOL_IMAGE=$BYOK_TOOL_IMAGE \
29-
--build-arg UBI_BASE_IMAGE=$UBI_BASE_IMAGE -t $OUT_IMAGE_TAG -f Containerfile.output \
31+
--build-arg UBI_BASE_IMAGE=$UBI_BASE_IMAGE --env VECTOR_DB_INDEX=$VECTOR_DB_INDEX \
32+
-t $OUT_IMAGE_TAG -f Containerfile.output \
3033
-v /markdown:/markdown:Z . && rm -f /output/$OUT_IMAGE_TAG.tar && \
3134
buildah push $OUT_IMAGE_TAG docker-archive:/output/$OUT_IMAGE_TAG.tar

byok/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ $ podman push $MY_BYOK_TOOL_IMAGE
2727

2828
```bash
2929
$ MY_BYOK_TOOL_IMAGE=quay.io/$USERNAME/byok_tool:0.0.1
30-
$ podman run -e OUT_IMAGE_TAG=my-byok-image -it --rm --device=/dev/fuse -v <dir_tree_with_markdown_files>:/markdown:Z -v <dir_for_image_tar>:/output:Z $MY_BYOK_TOOL_IMAGE
30+
$ podman run -e OUT_IMAGE_TAG=my-byok-image -it --rm --device=/dev/fuse \
31+
-v <dir_tree_with_markdown_files>:/markdown:Z \
32+
-v <dir_for_image_tar>:/output:Z \
33+
$MY_BYOK_TOOL_IMAGE
3134
```
3235

3336
The tool runs on CPUs, not GPUs.
@@ -71,4 +74,8 @@ total 1408
7174
$ podman run --rm localhost/byok-image-foobar:latest cat /rag/vector_db/metadata.json
7275
{"execution-time": 82.21773672103882, "llm": "None", "embedding-model-name": "sentence-transformers/all-mpnet-base-v2", "index-id": "vector_db_index", "vector-db": "faiss.IndexFlatIP", "embedding-dimension": 768, "chunk": 380, "overlap": 0, "total-embedded-files": 29}
7376
```
74-
The database is located at /rag/vector_db and the Faiss index id is "vector_db_index".
77+
The database is located at /rag/vector_db and by default the Faiss index id is "vector_db_index". The VECTOR_DB_INDEX environment variable can be used to override this default:
78+
79+
```bash
80+
$ podman run -e VECTOR_DB_INDEX=acme_openshift_sop ...
81+
```

byok/registries.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[registry]]
2+
location = "localhost:5000"
3+
insecure = true

0 commit comments

Comments
 (0)