fix: processor quivr version (#2934)

This commit is contained in:
AmineDiro 2024-07-31 21:57:28 +02:00 committed by GitHub
parent b6bb55d133
commit 2d64962ca4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View File

@ -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
@ -26,11 +26,16 @@ class ProcessorBase(ABC):
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,

View File

@ -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 \