mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-09-11 14:36:35 +03:00
fix: processor quivr version (#2934)
This commit is contained in:
parent
b6bb55d133
commit
2d64962ca4
@ -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,
|
||||
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user