Skip to content
Merged
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
6 changes: 4 additions & 2 deletions vector-serve/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update && \
make && \
rm -rf /var/lib/apt/lists/*

ARG PYTHON_VERSION=3.12.4
ARG PYTHON_VERSION=3.13.13
ARG PROJECT_NAME=vector-serve

ARG UV_PYTHON_INSTALL_DIR=/opt/python
Expand All @@ -28,7 +28,9 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

ENV UV_LINK_MODE=copy

COPY vector-serve .
COPY vector-serve/pyproject.toml .
COPY vector-serve/uv.lock .
COPY vector-serve/app ./app

RUN uv venv --python "${PYTHON_VERSION}" && \
uv sync --no-dev --frozen && \
Expand Down
19 changes: 9 additions & 10 deletions vector-serve/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@ authors = [
{ name = "Adam Hendel", email = "adam@hendel.dev" }
]
readme = "README.md"
requires-python = ">=3.10"
requires-python = ">=3.13"
dependencies = [
"fastapi[standard]>=0.115.2",
"sentence-transformers>=5",
"torch>=2.4.1",
"einops>=0.8.0",
"prometheus-client>=0.21.0",
"prometheus-fastapi-instrumentator>=7.0.0",
"huggingface-hub>=0.34.4",
"transformers>=4.55.0",
"huggingface-hub>=1.0.0",
"transformers>=5.6.0",
]

[tool.uv]
dev-dependencies = [
[tool.pytest.ini_options]
pythonpath = ["."]

[dependency-groups]
dev = [
"ruff",
"pytest>=8",
"pytest>=9",
"httpx>=0.27",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
8 changes: 5 additions & 3 deletions vector-serve/tests/test_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os


def test_ready_endpoint(test_client):
response = test_client.get("/ready")
assert response.status_code == 200
Expand All @@ -24,18 +25,19 @@ def test_metrics_endpoint(test_client):
assert response.status_code == 200
assert "all-MiniLM-L6-v2" in response.text


def test_private_hf_model(test_client):
response = test_client.post(
"/v1/embeddings",
headers={"authorization": f"bearer {os.environ['HF_API_KEY']}"},
json={
"input": ["string"],
"model": "chuckhend/private-model",
"normalize": False
}
"normalize": False,
},
)
assert response.status_code == 200
assert "data" in response.json()
embed = response.json()["data"][0]["embedding"]
assert isinstance(embed, list)
assert len(embed) == 384
assert len(embed) == 384
Loading
Loading