Skip to content

Commit

Permalink
fix: Minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Tomer <[email protected]>
  • Loading branch information
Diwank Tomer committed Aug 28, 2024
1 parent 9f5f0cb commit a03b57a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
3 changes: 2 additions & 1 deletion agents-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: julep-agents-api

# Base for embedding service
x--text-embeddings-inference: &text-embeddings-inference
container_name: text-embeddings-inference
container_name: text-embeddings-inference-cpu
environment:
- MODEL_ID=${EMBEDDING_MODEL_ID:-Alibaba-NLP/gte-large-en-v1.5}

Expand Down Expand Up @@ -92,6 +92,7 @@ services:

text-embeddings-inference-gpu:
<<: *text-embeddings-inference
container_name: text-embeddings-inference-gpu
profiles:
- gpu
image: ghcr.io/huggingface/text-embeddings-inference:1.5
Expand Down
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,34 @@ include:

# TODO: Enable after testing
# - ./monitoring/docker-compose.yml

### Notes on authentication

# - agents-api runs under two modes:
# + single-tenant: `SKIP_CHECK_DEVELOPER_HEADERS=True` and `AGENTS_API_KEY` is required
# [user] --{Authorization: Bearer $api-key}--> [agents-api]
# + multi-tenant:
# `SKIP_CHECK_DEVELOPER_HEADERS=False` and requests must have a valid `X-Developer-Id` header
# [user]
# --{Authorization: Bearer $JWT}--> [gateway]
# --{X-Developer-Id: $developer-id, Authorization: Bearer $internal-api-key}--> [agents-api]

# in single-tenant mode, developer id is assumed to be uuid '00000000-0000-0000-0000-000000000000'
# and this is the default value of `X-Developer-Id` header in this case
# the `developers` table in cozo-db will have a row with `id` = '00000000-0000-0000-0000-000000000000' and `name` = 'Default Developer'

# in multi-tenant mode, developer id is the id of the developer in the `developers` table in cozo-db
# and this id is expected in `X-Developer-Id` header
# the developer should have a valid JWT token issued by the gateway
# the JWT token is expected in `Authorization` header

# if the developer id is not found in the `developers` table in cozo-db, the request will be rejected

# in order for agents-api to work correctly in multi-tenant mode, the api assumes that:
# - the `gateway` is configured to forward `X-Developer-Id` header to agents-api

# and the gateway does that by expecting JWT token in `Authorization` header with the following claims:
# - `sub` claim is the developer ID
# - `email` claim is the developer email
# - `exp` claim is the expiration timestamp
# - `iat` claim is the issue timestamp
9 changes: 5 additions & 4 deletions gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ RUN git clone ${PLUGIN_GIT_REPO} /plugins-local/src/${PLUGIN_MODULE} \

#################

# TODO: Upgrade to Traefik v3
FROM traefik:v2.11

ENV GATEWAY_PORT=80
ENV JWT_SHARED_KEY=""
ENV MODEL_API_URL=""
ENV MODEL_API_KEY=""
ENV MODEL_API_KEY_HEADER_NAME="X-Auth-Key"
# ENV MODEL_API_URL=""
# ENV MODEL_API_KEY=""
# ENV MODEL_API_KEY_HEADER_NAME="Authorization"
ENV AGENTS_API_URL=""
ENV AGENTS_API_KEY=""
ENV AGENTS_API_KEY_HEADER_NAME="X-Auth-Key"
ENV AGENTS_API_KEY_HEADER_NAME="Authorization"

COPY --from=0 /plugins-local /plugins-local

Expand Down

0 comments on commit a03b57a

Please sign in to comment.