Skip to content

Commit

Permalink
0.6.1: feat: different docker flavors
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Feb 13, 2023
1 parent 842633c commit cbcf3ba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,37 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: Build and push Embedbase production with full dependencies
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
push: true
build-args: FLAVOR=all
tags: |
ghcr.io/${{ github.repository_owner }}/embedbase:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/embedbase:${{ env.VERSION }}-all
ghcr.io/${{ github.repository_owner }}/embedbase:latest
- name: Build and push Embedbase production with minimal dependencies
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
push: true
build-args: FLAVOR=minimal
tags: |
ghcr.io/${{ github.repository_owner }}/embedbase:${{ env.VERSION }}-minimal
- name: Build and push dev
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.dev
platforms: linux/amd64
push: true
build-args: FLAVOR=all
tags: |
ghcr.io/${{ github.repository_owner }}/embedbase:latest-dev
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ WORKDIR $APP_HOME
COPY . ./

ENV PORT 8080
# TODO: flavors
RUN pip install --no-cache-dir .[all]
ARG FLAVOR=all
RUN pip install --no-cache-dir .[$FLAVOR]

ENTRYPOINT ["docker/docker-entrypoint.sh"]
CMD ["embedbase"]
10 changes: 3 additions & 7 deletions embedbase/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from embedbase.pinecone_db import Pinecone
from embedbase.settings import Settings, get_settings
import openai
import sentry_sdk

from tenacity import retry
from tenacity.wait import wait_exponential
Expand All @@ -46,8 +45,11 @@
logger.addHandler(handler)


app = FastAPI()

if settings.sentry:
logger.info("Enabling Sentry")
import sentry_sdk
sentry_sdk.init(
dsn=settings.sentry,
# Set traces_sample_rate to 1.0 to capture 100%
Expand All @@ -60,8 +62,6 @@
},
)

app = FastAPI()

if settings.auth == "firebase":
from firebase_admin import auth

Expand Down Expand Up @@ -218,8 +218,6 @@ async def add(
"""
namespace = get_namespace(request, vault_id)

sentry_sdk.set_user({"id": vault_id})

documents = request_body.documents
# TODO: temporarily we ignore too big documents because pinecone doesn't support them
df = DataFrame(
Expand Down Expand Up @@ -351,7 +349,6 @@ async def delete(
Delete a document from the index
"""
namespace = get_namespace(request, vault_id)
sentry_sdk.set_user({"id": vault_id})

ids = request_body.ids
logger.info(f"Deleting {len(ids)} documents")
Expand All @@ -374,7 +371,6 @@ async def semantic_search(
"""
query = request_body.query
namespace = get_namespace(request, vault_id)
sentry_sdk.set_user({"id": vault_id})

top_k = 5 # TODO might fail if index empty?
if request_body.top_k > 0:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
name="embedbase",
packages=find_packages(),
include_package_data=True,
version="0.6.0",
version="0.6.1",
description="Open-source API for to easily create, store, and retrieve embeddings",
install_requires=install_requires,
extras_require=extras_require,
Expand Down

0 comments on commit cbcf3ba

Please sign in to comment.