You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+67-20Lines changed: 67 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -271,7 +271,7 @@ and slow down your queries to accommodate.
271
271
You can also specify them manually with any rate limit string that matches the specification in the [limits](https://limits.readthedocs.io/en/stable/quickstart.html#rate-limit-string-notation) module:
272
272
273
273
```bash
274
-
pqa --summary_llm_config '{"rate_limit": {"gpt-4o-2024-08-06": "30000 per 1 minute"}}' ask 'Are there nm scale features in thermoelectric materials?'
274
+
pqa --summary_llm_config '{"rate_limit": {"gpt-4o-2024-11-20": "30000 per 1 minute"}}' ask 'Are there nm scale features in thermoelectric materials?'
275
275
```
276
276
277
277
Or by adding into a `Settings` object, if calling imperatively:
@@ -282,8 +282,8 @@ from paperqa import Settings, ask
282
282
answer_response = ask(
283
283
"What manufacturing challenges are unique to bispecific antibodies?",
284
284
settings=Settings(
285
-
llm_config={"rate_limit": {"gpt-4o-2024-08-06": "30000 per 1 minute"}},
286
-
summary_llm_config={"rate_limit": {"gpt-4o-2024-08-06": "30000 per 1 minute"}},
285
+
llm_config={"rate_limit": {"gpt-4o-2024-11-20": "30000 per 1 minute"}},
286
+
summary_llm_config={"rate_limit": {"gpt-4o-2024-11-20": "30000 per 1 minute"}},
287
287
),
288
288
)
289
289
```
@@ -405,12 +405,13 @@ asyncio.run(main())
405
405
406
406
### Choosing Model
407
407
408
-
By default, PaperQA2 uses OpenAI's `gpt-4o-2024-08-06` model for:
409
-
410
-
-`summary_llm`: Re-ranking and summarizing evidence passages
411
-
-`llm`: Generating the final answer
412
-
-`agent_llm`: Making tool selection decisions
408
+
By default, PaperQA2 uses OpenAI's `gpt-4o-2024-11-20` model for the
409
+
`summary_llm`, `llm`, and `agent_llm`.
410
+
Please see the [Settings Cheatsheet](#settings-cheatsheet)
411
+
for more information on these settings.
413
412
413
+
We use the [`lmi`](https://github.com/Future-House/ldp/tree/main/packages/lmi) package for our LLM interface,
414
+
which in turn uses `litellm` to support many LLM providers.
414
415
You can adjust this easily to use any model supported by `litellm`:
415
416
416
417
```python
@@ -428,6 +429,7 @@ To use Claude, make sure you set the `ANTHROPIC_API_KEY`
428
429
429
430
```python
430
431
from paperqa import Settings, ask
432
+
from paperqa.settings import AgentSettings
431
433
432
434
answer_response = ask(
433
435
"What manufacturing challenges are unique to bispecific antibodies?",
@@ -769,9 +771,9 @@ will return much faster than the first query and we'll be certain the authors ma
|`llm`|`"gpt-4o-2024-08-06"`| Default LLM for most things, including answers. Should be 'best' LLM. |
774
+
|`llm`|`"gpt-4o-2024-11-20"`| Default LLM for most things, including answers. Should be 'best' LLM. |
773
775
|`llm_config`|`None`| Optional configuration for `llm`. |
774
-
|`summary_llm`|`"gpt-4o-2024-08-06"`| Default LLM for summaries and parsing citations. |
776
+
|`summary_llm`|`"gpt-4o-2024-11-20"`| Default LLM for summaries and parsing citations. |
775
777
|`summary_llm_config`|`None`| Optional configuration for `summary_llm`. |
776
778
|`embedding`|`"text-embedding-3-small"`| Default embedding model for texts. |
777
779
|`embedding_config`|`None`| Optional configuration for `embedding`. |
@@ -809,7 +811,7 @@ will return much faster than the first query and we'll be certain the authors ma
809
811
|`prompt.summary_json_system`|`summary_json_system_prompt`| System prompt for JSON summaries. |
810
812
|`prompt.context_outer`|`CONTEXT_OUTER_PROMPT`| Prompt for how to format all contexts in generate answer. |
811
813
|`prompt.context_inner`|`CONTEXT_INNER_PROMPT`| Prompt for how to format a single context in generate answer. Must contain 'name' and 'text' variables. |
812
-
|`agent.agent_llm`|`"gpt-4o-2024-08-06"`| Model to use for agent. |
814
+
|`agent.agent_llm`|`"gpt-4o-2024-11-20"`| Model to use for agent making tool selections.|
813
815
|`agent.agent_llm_config`|`None`| Optional configuration for `agent_llm`. |
814
816
|`agent.agent_type`|`"ToolSelector"`| Type of agent to use. |
815
817
|`agent.agent_config`|`None`| Optional kwarg for AGENT constructor. |
@@ -898,10 +900,19 @@ You can read more about the search syntax by typing `zotero.iterate?` in IPython
898
900
899
901
### Paper Scraper
900
902
901
-
If you want to search for papers outside of your own collection, I've found an unrelated project called [paper-scraper](https://github.com/blackadad/paper-scraper) that looks
903
+
If you want to search for papers outside of your own collection, I've found an unrelated project called [`paper-scraper`](https://github.com/blackadad/paper-scraper) that looks
902
904
like it might help. But beware, this project looks like it uses some scraping tools that may violate publisher's rights or be in a gray area of legality.
To execute a function on each chunk of LLM completions, you need to provide a function that can be executed on each chunk. For example, to get a typewriter view of the completions, you can do:
925
936
926
937
```python
938
+
from paperqa import Docs
939
+
940
+
927
941
deftypewriter(chunk: str) -> None:
928
942
print(chunk, end="")
929
943
@@ -1011,17 +1025,49 @@ with open("my_docs.pkl", "rb") as f:
1011
1025
## Reproduction
1012
1026
1013
1027
Contained in [docs/2024-10-16_litqa2-splits.json5](docs/2024-10-16_litqa2-splits.json5)
1014
-
are the question IDs
1015
-
(correspond with [LAB-Bench's LitQA2 question IDs](https://github.com/Future-House/LAB-Bench/blob/main/LitQA2/litqa-v2-public.jsonl))
1016
-
used in the train and evaluation splits,
1017
-
as well as paper DOIs used to build the train and evaluation splits' indexes.
1018
-
The test split remains held out.
1019
-
Example on how to use LitQA for evaluation can be found in [aviary.litqa](https://github.com/Future-House/aviary/tree/main/packages/litqa#running-litqa).
1028
+
are the question IDs used in train, evaluation, and test splits,
1029
+
as well as paper DOIs used to build the splits' indexes.
0 commit comments