-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor to breakout config from rest of code #289
Conversation
…d invalid code via blacken-docs
paperqa/config.py
Outdated
MaybeSettings = Settings | str | None | ||
|
||
|
||
def get_settings(config_or_name: MaybeSettings = None) -> Settings: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a classmethod
of Settings
, since that's mostly what this is
paperqa/config.py
Outdated
raise FileNotFoundError(f"No configuration file found for {config_name}") | ||
|
||
|
||
MaybeSettings = Settings | str | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this type alias, can we remove it?
paperqa/contrib/zotero.py
Outdated
@@ -240,7 +240,7 @@ def iterate( # noqa: C901, PLR0912 | |||
_pdfs = [self.get_pdf(item) for item in _items] | |||
|
|||
# Filter: | |||
for item, pdf in zip(_items, _pdfs): | |||
for item, pdf in zip(_items, _pdfs, strict=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment why we're not strict
here? To me, it seems we should be strict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
black junk - fixed
settings.agent.paper_directory = stub_data_dir | ||
settings.agent.index_directory = agent_index_dir | ||
settings.agent.search_count = 2 | ||
settings.embedding = "sparse" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we configure this in the instantiation of Settings(embedding="sparse")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not opposed - but why?
Ready for review - the PR is getting too sprawling to keep going. TODO list [for future PRs]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Large refactor to bring us closer to decoupling Docs, LLMs, and Config.
doc_match
anddoc_index
- these were only sometimes useful and not really part of current usage. We can add back if needed, but just complicated things.get_callbacks
factories. Now, callbacks can have a kwarg ofname
to get access to name of chain being called.contextvars
for settinganswer_id
in LLMResults so that we do not need to have so much back and forth for callbacks.Answer
objects until end of functions so that retrying is possible (except token counts)Docs
, exceptLLMModel
which will be fixed in port to litellm