Skip to content

Commit

Permalink
Adjust whitespace on detailed citations (#257)
Browse files Browse the repository at this point in the history
* Adjust whitespace on detailed citations

* Bumped version

* Changed tests for new format
  • Loading branch information
whitead authored Mar 19, 2024
1 parent c1bd914 commit c5a5532
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion paperqa/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ async def process(match): # noqa: C901, PLR0912
[
f"{c.text.name}: {c.context}"
+ "".join([f"\n{k}: {v}" for k, v in c.model_extra.items()])
+ (f"\n\nBased on {c.text.doc.citation}" if detailed_citations else "")
+ (f". From {c.text.doc.citation}" if detailed_citations else "")
for c in answer.contexts
]
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ name = "paper-qa"
readme = "README.md"
requires-python = ">=3.8"
urls = {repository = "https://github.com/whitead/paper-qa"}
version = "4.3.0"
version = "4.4.0"

[tool.codespell]
check-filenames = true
Expand Down
4 changes: 2 additions & 2 deletions tests/test_paperqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def test_evidence():
Answer(question="For which state was Bates a governor?"),
detailed_citations=True,
)
assert "Based on WikiMedia Foundation, 2023, Accessed now" in evidence.context
assert "From WikiMedia Foundation, 2023, Accessed now" in evidence.context
os.remove(doc_path)


Expand Down Expand Up @@ -581,7 +581,7 @@ def test_json_evidence():
Answer(question="For which state was Bates a governor?"),
detailed_citations=True,
)
assert "Based on WikiMedia Foundation, 2023, Accessed now" in evidence.context
assert "From WikiMedia Foundation, 2023, Accessed now" in evidence.context
os.remove(doc_path)


Expand Down

0 comments on commit c5a5532

Please sign in to comment.