Skip to content

Commit

Permalink
Actually testing that we exclude the embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza committed Mar 7, 2024
1 parent 064c4cf commit ac25d42
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_paperqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,19 @@ def test_evidence():
f.write(r.text)
docs = Docs()
docs.add(doc_path, "WikiMedia Foundation, 2023, Accessed now") # type: ignore[arg-type]
original_doc = next(iter(docs.docs.values()))
assert (
original_doc.embedding is not None
), "For downstream assertions of in-tact embedding, we need an embedding"
evidence = docs.get_evidence(
Answer(question="For which state was Bates a governor?"), k=1, max_sources=1
)
print(evidence.context)
assert "Missouri" in evidence.context
assert original_doc.embedding is not None, "Embedding should have remained in-tact"
assert (
evidence.contexts[0].text.doc.embedding is None
), "Embedding should have been removed"

evidence = docs.get_evidence(
Answer(question="For which state was Bates a governor?"),
Expand Down

0 comments on commit ac25d42

Please sign in to comment.