Buckets:

download
raw
1.08 kB
import pytest
from docuquery_ai.db.models import Document
from docuquery_ai.ingestion.pipeline import IngestionPipeline
@pytest.fixture
def ingestion_pipeline():
return IngestionPipeline()
@pytest.mark.asyncio
async def test_ingest_file(ingestion_pipeline, monkeypatch):
async def mock_generate_embeddings(self, text):
return [1.0, 2.0, 3.0]
async def mock_extract_entities(self, text):
return [{"text": "test", "label": "MISC"}]
monkeypatch.setattr(
"docuquery_ai.ingestion.embedding.EmbeddingGenerator.generate_embeddings",
mock_generate_embeddings,
)
monkeypatch.setattr(
"docuquery_ai.ingestion.ner.NER.extract_entities", mock_extract_entities
)
with open("/tmp/test.txt", "w") as f:
f.write("This is a test document.")
doc = await ingestion_pipeline.ingest_file("/tmp/test.txt", "test.txt")
assert doc.id == "test.txt"
assert doc.content == "This is a test document."
assert doc.embeddings == [1.0, 2.0, 3.0]
assert doc.entities == [{"text": "test", "label": "MISC"}]

Xet Storage Details

Size:
1.08 kB
·
Xet hash:
4513aa7af94b14c178bf45cfe9cdfb48750ff06b2fdeec75a444c23f58872159

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.