Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/paperqa/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

# These probably should be promoted to be on DocDetails
# but this will take a larger refactor.
DOC_DETAILS_OTHERS_TO_KEEP: Collection[str] = {"bibtex_source", "client_source"}
VAR_MATCH_LOOKUP: Collection[str] = {"1", "true"}
VAR_MISMATCH_LOOKUP: Collection[str] = {"0", "false"}
DEFAULT_FIELDS_TO_OVERWRITE_FROM_METADATA: Collection[str] = {
Expand Down Expand Up @@ -238,6 +237,12 @@ def populate_id(cls, data: dict[str, Any]) -> dict[str, Any]:
class PQASession(BaseModel):
"""A class to hold session about researching/answering."""

# Keys in the other field to not remove when filtering for user display
DOC_DETAILS_OTHERS_TO_KEEP: ClassVar[Collection[str]] = {
"bibtex_source",
"client_source",
}

model_config = ConfigDict(extra="ignore", populate_by_name=True)

id: UUID = Field(default_factory=uuid4)
Expand Down Expand Up @@ -381,7 +386,7 @@ def filter_content_for_user(self) -> None:
c.text.doc.other = {
k: v
for k, v in c.text.doc.other.items()
if k in DOC_DETAILS_OTHERS_TO_KEEP
if k in self.DOC_DETAILS_OTHERS_TO_KEEP
}

def populate_formatted_answers_and_bib_from_raw_answer(
Expand Down