feat(ingestion): implement Phase 5 background worker, orchestration, and publication
- Add background worker daemon for job lease acquisition and heartbeat maintenance - Implement atomic document publication, failed job retry backoff, and review resume - Add WorkerRepository for atomic database claims and lease fencing - Add migration 0002_worker_artifact for extraction state tracking - Add extensive unit and integration test coverage for worker orchestration and review resumes
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""Provider-free worker controls and independent command help."""
|
||||
import subprocess
|
||||
import sys
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.documents.worker import Claim, Worker, LostClaim, retry_delay, read_original
|
||||
|
||||
|
||||
@pytest.mark.parametrize("attempt", [1, 2, 3, 100, 2**31])
|
||||
def test_retry_backoff_is_bounded(attempt):
|
||||
low = retry_delay(attempt, 2, 300, uniform=lambda a, b: a)
|
||||
high = retry_delay(attempt, 2, 300, uniform=lambda a, b: b)
|
||||
assert 2 <= low <= high <= 300
|
||||
if attempt == 3:
|
||||
assert high == 8
|
||||
|
||||
|
||||
@pytest.mark.parametrize("command", [["app.worker", "--help"], ["app.ingest", "retry", "--help"]])
|
||||
def test_command_help_needs_no_configuration_or_providers(command):
|
||||
result = subprocess.run([sys.executable, "-m", *command], capture_output=True, text=True)
|
||||
assert result.returncode == 0
|
||||
assert "idempotency" in result.stdout or "--once" in result.stdout
|
||||
|
||||
|
||||
def test_once_empty_poll_does_not_construct_providers(settings):
|
||||
class Repository:
|
||||
def claim(self, *args):
|
||||
return None
|
||||
|
||||
def forbidden(*args):
|
||||
pytest.fail("No providers without a claim")
|
||||
|
||||
assert not Worker(Repository(), None, None, forbidden, forbidden, settings).run_once("worker")
|
||||
|
||||
|
||||
def test_lost_claim_discards_results_without_failure_write(settings):
|
||||
class Repository:
|
||||
def claim(self, *args):
|
||||
return Claim({}, uuid4(), uuid4(), 1, 0)
|
||||
|
||||
def progress(self, *args):
|
||||
raise LostClaim()
|
||||
|
||||
def fail(self, *args, **kwargs):
|
||||
pytest.fail("Stale worker must not write failure")
|
||||
|
||||
assert Worker(Repository(), None, None, None, None, settings).run_once("worker")
|
||||
|
||||
|
||||
def test_read_original_uses_frozen_limit_and_verifies_checksum():
|
||||
class Store:
|
||||
def read_bounded(self, key, limit):
|
||||
assert key == "trusted" and limit == 7
|
||||
return b"changed"
|
||||
|
||||
with pytest.raises(ValueError, match="integrity"):
|
||||
read_original(Store(), dict(processing_profile={"limits": {"max_original_bytes": 7}},
|
||||
size_bytes=7, file_sha256="a" * 64, storage_key="trusted"))
|
||||
|
||||
@pytest.mark.parametrize("pointer", [None, {}, {"key": None}, {"extra": "field"}])
|
||||
def test_invalid_trusted_pointer_fails_permanently_without_storage_io(tmp_path, pointer):
|
||||
from app.infrastructure.extraction_candidates import LocalExtractionCandidates
|
||||
candidates = LocalExtractionCandidates(tmp_path / "extract", original_directory=tmp_path / "original")
|
||||
with pytest.raises(ValueError, match="Invalid trusted"):
|
||||
candidates.inspect_pointer(pointer, document={})
|
||||
@@ -0,0 +1,164 @@
|
||||
"""Regression evidence for the three scoped Phase 5 backend repairs."""
|
||||
import hashlib
|
||||
from uuid import uuid4
|
||||
import pytest
|
||||
|
||||
from app.modules.documents.extraction import PageBlockExtractor, ReviewApproval, REVIEW_CHECKS, ReviewRequired
|
||||
from app.modules.documents.review import factual_groups, factual_digest, prepare_chunks
|
||||
from app.modules.documents.worker import validate_source
|
||||
from tests.support.extraction import FakeVision
|
||||
from tests.support.formats import image_bytes
|
||||
|
||||
|
||||
def factual(content, settings):
|
||||
profile = settings.model_copy(update={"chunk_size_characters": 2000}).processing_profile()
|
||||
raw = content.encode()
|
||||
envelope = PageBlockExtractor().extract_for_review(document_id=uuid4(), title="facts",
|
||||
original_sha256=hashlib.sha256(raw).hexdigest(), content=raw,
|
||||
mime_type="text/markdown", processing_profile=profile)
|
||||
state = {"factual_inclusion": dict(decision="approve", reviewer=str(uuid4()),
|
||||
artifact_sha256="a" * 64, evidence_sha256=factual_digest("a" * 64, envelope),
|
||||
excluded_group_ids=[])}
|
||||
return raw, profile, envelope, state
|
||||
|
||||
|
||||
def test_eligibility_context_survives_all_pairs_approved(settings):
|
||||
raw, profile, envelope, state = factual("## Eligibility\nThese answers apply only to permanent employees.\nQuestion: allowance?\nAnswer: The allowance is 5%.\n", settings)
|
||||
chunks = prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
assert len(chunks) == 1
|
||||
assert "## Eligibility" in chunks[0].text
|
||||
assert "only to permanent employees" in chunks[0].text
|
||||
assert all(b.source_locator in chunks[0].section for b in envelope.blocks)
|
||||
assert "".join(b.text for b in envelope.blocks).encode() == raw
|
||||
|
||||
|
||||
def test_negated_unreadability_review_note_is_not_quality_flag(settings):
|
||||
profile = settings.model_copy(update={"vision_provider": "fixture",
|
||||
"vision_endpoint": "https://fixture.invalid/v1", "vision_model": "fixture-flash"}).processing_profile()
|
||||
raw = image_bytes("PNG")
|
||||
kwargs = dict(document_id=uuid4(), title="review", original_sha256=hashlib.sha256(raw).hexdigest(),
|
||||
content=raw, mime_type="image/png", processing_profile=profile)
|
||||
vision = FakeVision(text="Readable evidence")
|
||||
with pytest.raises(ReviewRequired) as required:
|
||||
PageBlockExtractor(vision).extract(**kwargs)
|
||||
approval = ReviewApproval(required.value.evidence_sha256, "trusted-reviewer",
|
||||
"No unreadable regions; checked all fields.", REVIEW_CHECKS)
|
||||
envelope = PageBlockExtractor(vision, reviews=(approval,)).extract(**kwargs)
|
||||
validate_source(envelope, dict(id=kwargs["document_id"], title="review", mime_type="image/png",
|
||||
processing_profile=profile), raw)
|
||||
|
||||
def test_multiple_pairs_share_the_governing_condition(settings):
|
||||
_, profile, envelope, state = factual("## Eligibility\nThese answers apply only to permanent employees.\nQuestion: allowance?\nAnswer: 5%.\nQuestion: leave?\nAnswer: 10 days.\n", settings)
|
||||
chunks = prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
assert len(chunks) == 2
|
||||
for chunk in chunks:
|
||||
assert "## Eligibility" in chunk.text and "only to permanent employees" in chunk.text
|
||||
assert envelope.blocks[0].source_locator in chunk.section
|
||||
assert "allowance" in chunks[0].text and "leave" in chunks[1].text
|
||||
|
||||
|
||||
def test_section_conditions_and_exceptions_do_not_leak_to_siblings(settings):
|
||||
raw, profile, envelope, state = factual("# Benefits\nApplies only to permanent employees.\n## Allowances\nContractors are not eligible; except approved interns.\nQuestion: rate?\nAnswer: 5%.\n## Leave\nOnly after one year; unless probation continues.\nQuestion: days?\nAnswer: 10.\n", settings)
|
||||
first, second = prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
assert "permanent employees" in first.text and "permanent employees" in second.text
|
||||
assert "Contractors are not eligible" in first.text and "except approved interns" in first.text
|
||||
assert "probation" not in first.text and "Contractors" not in second.text
|
||||
assert "Only after one year; unless probation continues." in second.text
|
||||
assert "".join(b.text for b in envelope.blocks).encode() == raw
|
||||
|
||||
|
||||
def test_excluded_pairs_and_exclusive_context_are_absent(settings):
|
||||
_, profile, envelope, state = factual("# Benefits\nOnly permanent employees.\n## Factual\nOnly after one year.\nQuestion: fee?\nAnswer: 5%.\n## Behavioral\nUse scripted welcoming tone.\nQuestion: greeting?\nAnswer: scripted welcome.\n## Balance\nQuestion: amount?\nAnswer: <current placeholder>\n", settings)
|
||||
excluded = [b.group_id for b in envelope.blocks if b.block_type == "question" and "fee" not in b.text]
|
||||
state["factual_inclusion"]["excluded_group_ids"] = excluded
|
||||
chunk, = prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
assert "Only permanent employees" in chunk.text and "Only after one year" in chunk.text
|
||||
assert all(x not in chunk.text for x in ("Behavioral", "scripted", "Balance", "placeholder"))
|
||||
assert "<current placeholder>" in "".join(b.text for b in envelope.blocks)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("content", [
|
||||
"These answers apply only to permanent employees.\nQuestion: fee?\nAnswer: 5%.\n",
|
||||
"## Eligibility\nQuestion: fee?\nAnswer: 5%.\n## Exceptions\nContractors are not eligible.\n",
|
||||
"Question: fee?\nAnswer: 5%.\nArticle 2\nOnly permanent employees.\nQuestion: leave?\nAnswer: 10.\n",
|
||||
])
|
||||
def test_ambiguous_context_fails_visibly_even_when_all_pairs_approved(settings, content):
|
||||
from app.modules.documents.extraction import ExtractionError
|
||||
_, profile, envelope, state = factual(content, settings)
|
||||
with pytest.raises(ExtractionError):
|
||||
prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
|
||||
|
||||
def test_selection_cannot_hide_noncontiguous_groups(settings):
|
||||
from app.modules.documents.extraction import ExtractionError
|
||||
_, profile, envelope, state = factual("Question: fee?\nAnswer: 5%.\nQuestion: greeting?\nAnswer: scripted.\n", settings)
|
||||
first, answer, second, other = envelope.blocks
|
||||
# Both pairs remain complete, but the first pair is no longer contiguous.
|
||||
reordered = tuple(b.model_copy(update={"ordinal": i}) for i, b in enumerate((first, second, other, answer)))
|
||||
bad = envelope.model_copy(update={"blocks": reordered})
|
||||
state["factual_inclusion"]["excluded_group_ids"] = [first.group_id]
|
||||
with pytest.raises(ExtractionError, match="Noncontiguous"):
|
||||
prepare_chunks(bad, profile, state, "a" * 64)
|
||||
|
||||
|
||||
def test_selection_cannot_hide_unresolved_dependency(settings):
|
||||
from app.modules.documents.extraction import ExtractionError
|
||||
_, profile, envelope, state = factual("Question: fee?\nAnswer: 5%.\nQuestion: greeting?\nAnswer: scripted.\n", settings)
|
||||
group = envelope.blocks[-1].group_id
|
||||
bad_answer = envelope.blocks[-1].model_copy(update={"text": "Article 1\nException: Article 2 applies.\n",
|
||||
"search_text": None})
|
||||
bad = envelope.model_copy(update={"blocks": (*envelope.blocks[:-1], bad_answer)})
|
||||
state["factual_inclusion"]["excluded_group_ids"] = [group]
|
||||
with pytest.raises(ExtractionError, match="Ambiguous"):
|
||||
prepare_chunks(bad, profile, state, "a" * 64)
|
||||
|
||||
|
||||
def test_governing_placeholder_cannot_be_approved(settings):
|
||||
from app.modules.documents.extraction import ExtractionError
|
||||
from app.modules.documents.normalization import normalize_search_text
|
||||
_, profile, envelope, state = factual("## Eligibility\nOnly permanent employees.\nQuestion: fee?\nAnswer: 5%.\n", settings)
|
||||
changed = envelope.blocks[0].model_copy(update={"text": "## Eligibility\nOnly <current placeholder>.\n",
|
||||
"search_text": normalize_search_text("## Eligibility\nOnly <current placeholder>.\n")})
|
||||
bad = envelope.model_copy(update={"blocks": (changed, *envelope.blocks[1:])})
|
||||
with pytest.raises(ExtractionError, match="Placeholder"):
|
||||
prepare_chunks(bad, profile, state, "a" * 64)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("note", ["No unreadable regions; checked all fields.",
|
||||
"\u0647\u06cc\u0686 \u0628\u062e\u0634 \u0646\u0627\u062e\u0648\u0627\u0646\u0627 \u0646\u06cc\u0633\u062a.", "checked " * 249])
|
||||
def test_resume_keeps_note_once_as_bounded_metadata(settings, note):
|
||||
from app.modules.documents.extraction import ExtractionError
|
||||
from app.modules.documents.extraction_artifacts import serialize_artifact
|
||||
profile = settings.model_copy(update={"vision_provider": "fixture",
|
||||
"vision_endpoint": "https://fixture.invalid/v1", "vision_model": "fixture-flash"}).processing_profile()
|
||||
raw = image_bytes("PNG")
|
||||
kwargs = dict(document_id=uuid4(), title="review", original_sha256=hashlib.sha256(raw).hexdigest(),
|
||||
content=raw, mime_type="image/png", processing_profile=profile)
|
||||
vision = FakeVision(text="Readable evidence")
|
||||
with pytest.raises(ReviewRequired) as required:
|
||||
PageBlockExtractor(vision).extract(**kwargs)
|
||||
evidence = required.value
|
||||
body = dict(evidence_sha256=evidence.evidence_sha256, blocks=[b.model_dump(mode="json") for b in evidence.blocks],
|
||||
reasons=list(evidence.reasons))
|
||||
decision = dict(decision="approve", reviewer="trusted-reviewer", checked=list(REVIEW_CHECKS),
|
||||
note=note, evidence_sha256=evidence.evidence_sha256)
|
||||
calls = len(vision.calls)
|
||||
envelope = PageBlockExtractor(vision).extract_for_review(retained=lambda _: (body, decision), **kwargs)
|
||||
assert len(vision.calls) == calls
|
||||
annotation, = envelope.review_annotations
|
||||
assert annotation.note == note and annotation.reviewer == "trusted-reviewer"
|
||||
assert annotation.checked == REVIEW_CHECKS and annotation.evidence_sha256 == evidence.evidence_sha256
|
||||
assert all(note not in b.warnings for b in envelope.blocks)
|
||||
validate_source(envelope, dict(title="review", mime_type="image/png", processing_profile=profile), raw)
|
||||
serialized = serialize_artifact(envelope, profile)
|
||||
limited = {**profile, "extraction": {**profile["extraction"], "max_extraction_artifact_bytes": len(serialized) - 1}}
|
||||
with pytest.raises(ValueError, match="byte limit"):
|
||||
serialize_artifact(envelope, limited)
|
||||
decision["note"] = "x" * 2001
|
||||
with pytest.raises(ValueError):
|
||||
PageBlockExtractor(vision).extract_for_review(retained=lambda _: (body, decision), **kwargs)
|
||||
body["blocks"][0]["warnings"] = ["unreadable source region"]
|
||||
decision["note"] = note
|
||||
broken = PageBlockExtractor(vision).extract_for_review(retained=lambda _: (body, decision), **kwargs)
|
||||
with pytest.raises(ExtractionError, match="Unreadable"):
|
||||
validate_source(broken, dict(title="review", mime_type="image/png", processing_profile=profile), raw)
|
||||
@@ -0,0 +1,159 @@
|
||||
"""Provider-free regression checks for configuration and factual preparation."""
|
||||
import hashlib
|
||||
from io import BytesIO
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from PIL import Image
|
||||
from pydantic import SecretStr, ValidationError
|
||||
|
||||
from app.modules.documents.extraction import PageBlockExtractor, ExtractionError
|
||||
from app.modules.documents.chunking import chunk_extraction
|
||||
from app.modules.documents.operational_limits import MAX_OPERATIONAL_SECONDS
|
||||
from app.modules.documents.review import (
|
||||
ReviewDecision, FactualReviewRequired, factual_digest, factual_groups, prepare_chunks,
|
||||
)
|
||||
from app.modules.documents.worker import Worker, LostClaim
|
||||
from app.worker import factories
|
||||
|
||||
|
||||
def extract_faq(settings):
|
||||
content = b"Question: fee\nAnswer: 5%\nQuestion: greeting\nAnswer: scripted welcome\nQuestion: balance\nAnswer: <current placeholder>\n"
|
||||
profile = settings.processing_profile()
|
||||
envelope = PageBlockExtractor().extract_for_review(document_id=uuid4(), title="facts",
|
||||
original_sha256=hashlib.sha256(content).hexdigest(), content=content,
|
||||
mime_type="text/markdown", processing_profile=profile)
|
||||
return content, profile, envelope
|
||||
|
||||
|
||||
def manifest(envelope, excluded, digest="a" * 64):
|
||||
return dict(decision="approve", reviewer=str(uuid4()), artifact_sha256=digest,
|
||||
evidence_sha256=factual_digest(digest, envelope), excluded_group_ids=excluded)
|
||||
|
||||
|
||||
def test_faithful_mixed_faq_retention_and_only_whole_approved_pairs(settings):
|
||||
content, profile, envelope = extract_faq(settings)
|
||||
assert "<current placeholder>" in "".join(b.text for b in envelope.blocks)
|
||||
groups = sorted(factual_groups(envelope))
|
||||
selected = next(b.group_id for b in envelope.blocks if "fee" in b.text)
|
||||
state = {"factual_inclusion": manifest(envelope, list(set(groups) - {selected}))}
|
||||
chunks = prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
assert len(chunks) == 1 and chunks[0].ordinal == 0
|
||||
assert "Question: fee" in chunks[0].text and "Answer: 5%" in chunks[0].text
|
||||
assert "greeting" not in chunks[0].text and "placeholder" not in chunks[0].text
|
||||
with pytest.raises(ExtractionError):
|
||||
PageBlockExtractor().extract(document_id=envelope.document_id, title="facts",
|
||||
original_sha256=envelope.original_sha256, content=content,
|
||||
mime_type="text/markdown", processing_profile=profile)
|
||||
with pytest.raises(ExtractionError):
|
||||
chunk_extraction(envelope, profile, corpus_purpose="approved_factual")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("failure", ["missing", "digest", "unknown_group", "all_excluded", "placeholder"])
|
||||
def test_manifest_approval_cannot_make_invalid_groups_authoritative(settings, failure):
|
||||
_, profile, envelope = extract_faq(settings)
|
||||
groups = list(factual_groups(envelope))
|
||||
value = manifest(envelope, [])
|
||||
if failure == "missing":
|
||||
state = {}
|
||||
else:
|
||||
if failure == "digest":
|
||||
value["artifact_sha256"] = "b" * 64
|
||||
elif failure == "unknown_group":
|
||||
value["excluded_group_ids"] = ["client-invented-group"]
|
||||
elif failure == "all_excluded":
|
||||
value["excluded_group_ids"] = groups
|
||||
state = {"factual_inclusion": value}
|
||||
with pytest.raises(ExtractionError):
|
||||
prepare_chunks(envelope, profile, state, "a" * 64)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("field", ["poll_seconds", "heartbeat_seconds", "lease_seconds",
|
||||
"retry_base_seconds", "retry_cap_seconds"])
|
||||
@pytest.mark.parametrize("value", [1e20, float("inf"), float("nan"), 0, 1e-12, MAX_OPERATIONAL_SECONDS + 1])
|
||||
def test_operational_duration_is_rejected_during_settings_validation(settings, field, value):
|
||||
values = settings.model_dump()
|
||||
values[field] = value
|
||||
with pytest.raises(ValidationError):
|
||||
type(settings)(_env_file=None, **values)
|
||||
|
||||
|
||||
def test_unchecked_settings_cannot_start_worker_or_claim(settings, monkeypatch):
|
||||
class ForbiddenRepository:
|
||||
def claim(self, *args):
|
||||
pytest.fail("Invalid duration reached claiming")
|
||||
monkeypatch.setattr("app.modules.documents.worker.Thread",
|
||||
lambda *a, **k: pytest.fail("Invalid duration started heartbeat"))
|
||||
invalid = settings.model_copy(update={"lease_seconds": 1e20})
|
||||
with pytest.raises(ValueError, match="representable"):
|
||||
Worker(ForbiddenRepository(), None, None, None, None, invalid)
|
||||
|
||||
|
||||
def test_frozen_vision_identity_and_secret_independent_of_current_defaults(settings, monkeypatch):
|
||||
profile = settings.processing_profile()
|
||||
frozen = dict(provider="gemini", endpoint="https://frozen.invalid", model="frozen-model",
|
||||
timeout_seconds=7)
|
||||
profile["extraction"]["vision"] = frozen
|
||||
current = settings.model_copy(update={"vision_api_key": SecretStr("server-only-secret")})
|
||||
received = []
|
||||
|
||||
class Vision:
|
||||
def __init__(self, **kwargs):
|
||||
received.append(kwargs)
|
||||
def transcribe(self, *args, **kwargs):
|
||||
return ()
|
||||
|
||||
monkeypatch.setattr("app.infrastructure.gemini_vision.GeminiVision", Vision)
|
||||
extractor = factories(current)[0](profile)
|
||||
assert received == []
|
||||
extractor.vision.transcribe(b"not-real-provider", page=None, section="image", processing_profile=profile)
|
||||
assert received == [{**frozen, "api_key": "server-only-secret"}]
|
||||
assert current.vision_model is None and profile["extraction"]["vision"] == frozen
|
||||
|
||||
|
||||
def test_direct_extraction_does_not_need_unused_vision_credentials(settings, monkeypatch):
|
||||
profile = settings.processing_profile()
|
||||
profile["extraction"]["vision"] = dict(provider="gemini", endpoint="https://frozen.invalid",
|
||||
model="frozen-model", timeout_seconds=7)
|
||||
monkeypatch.setattr("app.infrastructure.gemini_vision.GeminiVision",
|
||||
lambda **k: pytest.fail("Direct extraction constructed vision"))
|
||||
content = b"direct evidence"
|
||||
result = factories(settings)[0](profile).extract_for_review(
|
||||
document_id=uuid4(), title="direct", original_sha256=hashlib.sha256(content).hexdigest(),
|
||||
content=content, mime_type="text/markdown", processing_profile=profile)
|
||||
assert result.complete and result.blocks[0].text == "direct evidence"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("payload", [
|
||||
{"note": " "}, {"note": "\u0000"}, {"checked": ["readability", "readability"]},
|
||||
{"reviewer": "client-forged"}, {"decision": "force"}, {"excluded_group_ids": ["x", "x"]},
|
||||
])
|
||||
def test_decision_validation_rejects_invalid_or_client_identity_fields(payload):
|
||||
value = dict(evidence_sha256="a" * 64, decision="approve", checked=["readability"], note="review")
|
||||
value.update(payload)
|
||||
with pytest.raises(ValueError):
|
||||
ReviewDecision.model_validate(value)
|
||||
|
||||
|
||||
def test_late_vision_result_is_rejected_before_review_candidate_construction(settings):
|
||||
from app.modules.documents.types import ExtractedBlock
|
||||
stream = BytesIO()
|
||||
Image.new("RGB", (20, 20)).save(stream, "PNG")
|
||||
content = stream.getvalue()
|
||||
profile = settings.processing_profile()
|
||||
profile["extraction"]["vision"] = dict(provider="gemini", endpoint="https://frozen.invalid",
|
||||
model="frozen-model", timeout_seconds=7)
|
||||
late = False
|
||||
def owned():
|
||||
if late:
|
||||
raise LostClaim()
|
||||
class Vision:
|
||||
def transcribe(self, image, *, page, section, processing_profile):
|
||||
nonlocal late
|
||||
late = True
|
||||
return (ExtractedBlock(ordinal=0, block_id="image/1", source_locator="image/1",
|
||||
text="evidence", method="vision", actual_model="frozen-model"),)
|
||||
with pytest.raises(LostClaim):
|
||||
PageBlockExtractor(Vision()).extract_for_review(owned=owned,
|
||||
document_id=uuid4(), title="image", original_sha256=hashlib.sha256(content).hexdigest(),
|
||||
content=content, mime_type="image/png", processing_profile=profile)
|
||||
Reference in New Issue
Block a user