Skip to content

Commit

Permalink
fix: processor quivr version (#2934)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineDiro committed Jul 31, 2024
1 parent b6bb55d commit 2d64962
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 7 additions & 2 deletions backend/core/quivr_core/processor/processor_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from importlib.metadata import version
from importlib.metadata import PackageNotFoundError, version
from typing import Any
from uuid import uuid4

Expand All @@ -26,11 +26,16 @@ def processor_metadata(self) -> dict[str, Any]:
async def process_file(self, file: QuivrFile) -> list[Document]:
self.check_supported(file)
docs = await self.process_file_inner(file)
try:
qvr_version = version("quivr-core")
except PackageNotFoundError:
qvr_version = "dev"

for idx, doc in enumerate(docs):
doc.metadata = {
"id": uuid4(),
"chunk_index": idx,
"quivr_core_version": version("quivr-core"),
"quivr_core_version": qvr_version,
**file.metadata,
**doc.metadata,
**self.processor_metadata,
Expand Down
11 changes: 10 additions & 1 deletion backend/core/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ commands =
allowlist_externals =
poetry
commands_pre =
poetry install --no-root -E csv -E md -E ipynb -E epub -E odt -E docx -E pptx -E xlsx --with test
poetry install --no-root \
-E csv \
-E md \
-E ipynb \
-E epub \
-E odt \
-E docx \
-E pptx \
-E xlsx \
--with test
commands =
poetry run pytest tests/processor/epub \
tests/processor/docx \
Expand Down

0 comments on commit 2d64962

Please sign in to comment.