Skip to content

Commit 3c8859e

Browse files
authored
Merge pull request #30 from matysek/lcore-239
LCORE-239: Update packages torch, llama-index, fais-cpu, huggingface-hub
2 parents 6d45e9c + ae85881 commit 3c8859e

File tree

5 files changed

+559
-390
lines changed

5 files changed

+559
-390
lines changed

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@ jobs:
2929
run: uv pip install pdm
3030
- name: Run unit tests
3131
run: |
32-
uv run coverage run --source=src/lightspeed_rag_content -m unittest discover tests --verbose
33-
uv run coverage report -m --fail-under 90
32+
uv run pytest tests --cov=src/lightspeed_rag_content --cov=runner --cov-report term-missing --cov-fail-under=90

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NUM_WORKERS ?= $$(( $(shell nproc --all) / 2))
2+
ARTIFACT_DIR := $(if $(ARTIFACT_DIR),$(ARTIFACT_DIR),tests/test_results)
23

34
# Define arguments for pgvector support
45
POSTGRES_USER ?= postgres
@@ -7,6 +8,13 @@ POSTGRES_HOST ?= localhost
78
POSTGRES_PORT ?= 15432
89
POSTGRES_DATABASE ?= postgres
910

11+
12+
.PHONY: unit-test
13+
test-unit: ## Run the unit tests
14+
@echo "Running unit tests..."
15+
@echo "Reports will be written to ${ARTIFACT_DIR}"
16+
COVERAGE_FILE="${ARTIFACT_DIR}/.coverage.unit" uv run pytest tests --cov=src/lightspeed_rag_content --cov-report term-missing --cov-report "json:${ARTIFACT_DIR}/coverage_unit.json" --junit-xml="${ARTIFACT_DIR}/junit_unit.xml" --cov-fail-under=60
17+
1018
.PHONY: install-tools
1119
install-tools: ## Install required utilities/tools
1220
@command -v uv > /dev/null || { echo >&2 "uv is not installed. Installing..."; pip3.11 install --upgrade pip uv; }

pyproject.toml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ version = "0.1.0"
2929
description = "RAG content for OpenShift LightSpeed."
3030
authors = []
3131
dependencies = [
32-
"PyYAML==6.0.1",
33-
"huggingface_hub>=0.23.4",
34-
"llama-index==0.10.62",
35-
"llama-index-vector-stores-faiss==0.1.2",
36-
"llama-index-embeddings-huggingface==0.2.2",
37-
"llama-index-readers-file==0.1.30",
38-
"faiss-cpu==1.8.0.post1",
39-
"llama-index-vector-stores-postgres>=0.1.14",
40-
"torch==2.3.1",
32+
"PyYAML==6.0.2",
33+
"huggingface_hub>=0.33.4",
34+
"llama-index==0.12.51",
35+
"llama-index-vector-stores-faiss==0.3.0",
36+
"llama-index-embeddings-huggingface==0.4.0",
37+
"llama-index-readers-file==0.4.11",
38+
"faiss-cpu==1.11.0.post1",
39+
"llama-index-vector-stores-postgres>=0.5.4",
40+
"torch==2.7.0",
4141
]
4242
requires-python = "==3.11.*"
4343
dynamic = ["license", "readme"]
@@ -54,16 +54,18 @@ torchvision = [{ index = "pytorch-cpu" }]
5454

5555
[dependency-groups]
5656
dev = [
57-
"black==24.10.0",
58-
"mypy==1.12.0",
59-
"ruff==0.6.9",
60-
"types-requests==2.32.0.20240622",
61-
"pre-commit==4.0.1",
57+
"black>=25.1.0",
58+
"mypy>=1.15.0",
59+
"ruff>=0.12.4",
60+
"types-requests>=2.32.0.20240622",
61+
"pre-commit>=4.2.0",
6262
"coverage>=7.6.12",
63-
"huggingface-hub>=0.23.4",
63+
"huggingface-hub>=0.33.4",
6464
"radon>=6.0.1",
6565
"pyright>=1.1.401",
6666
"pylint>=3.3.7",
67+
"pytest>=8.3.4",
68+
"pytest-cov>=6.0.0",
6769
]
6870

6971
[tool.pylint."MESSAGES CONTROL"]

tests/test_document_processor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
from llama_index.core import Document
2323
from lightspeed_rag_content import document_processor
2424

25+
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
26+
2527

2628
# Mock class for HuggingFaceEmbedding
27-
class MockEmbedding:
29+
class RagMockEmbedding(MockEmbedding):
2830
def __init__(self, model_name="ABC"):
29-
pass
31+
super().__init__(embed_dim=256)
3032

3133
def get_text_embedding(self, text):
3234
return "ABC"
@@ -207,7 +209,7 @@ def test_save(self):
207209
)
208210
@mock.patch(
209211
"lightspeed_rag_content.document_processor.HuggingFaceEmbedding",
210-
new=MockEmbedding,
212+
new=RagMockEmbedding,
211213
)
212214
def test_pgvector(self):
213215
self.patcher.stop() # Remove the mock on the _get_settings() method
@@ -223,7 +225,7 @@ def test_pgvector(self):
223225

224226
@mock.patch(
225227
"lightspeed_rag_content.document_processor.HuggingFaceEmbedding",
226-
new=MockEmbedding,
228+
new=RagMockEmbedding,
227229
)
228230
def test_invalid_vector_store_type(self):
229231
self.patcher.stop() # Remove the mock on the _get_settings() method

0 commit comments

Comments
 (0)