@@ -362,7 +362,9 @@ from paperqa import Settings, ask
362
362
363
363
answer_response = ask(
364
364
" What is PaperQA2?" ,
365
- settings = Settings(temperature = 0.5 , paper_directory = " my_papers" ),
365
+ settings = Settings(
366
+ temperature = 0.5 , agent = {" index" : {" paper_directory" : " my_papers" }}
367
+ ),
366
368
)
367
369
```
368
370
@@ -374,7 +376,9 @@ from paperqa import Settings, agent_query
374
376
375
377
answer_response = await agent_query(
376
378
query = " What is PaperQA2?" ,
377
- settings = Settings(temperature = 0.5 , paper_directory = " my_papers" ),
379
+ settings = Settings(
380
+ temperature = 0.5 , agent = {" index" : {" paper_directory" : " my_papers" }}
381
+ ),
378
382
)
379
383
```
380
384
@@ -469,7 +473,7 @@ from paperqa import Settings, ask
469
473
answer_response = ask(
470
474
" What is PaperQA2?" ,
471
475
settings = Settings(
472
- llm = " gpt-4o-mini" , summary_llm = " gpt-4o-mini" , paper_directory = " my_papers"
476
+ llm = " gpt-4o-mini" , summary_llm = " gpt-4o-mini" , agent = { " index " : { " paper_directory " : " my_papers" }}
473
477
),
474
478
)
475
479
```
@@ -772,9 +776,9 @@ for ... in my_docs:
772
776
Indexes will be placed in the [ home directory] [ home dir ] by default.
773
777
This can be controlled via the ` PQA_HOME ` environment variable.
774
778
775
- Indexes are made by reading files in the ` Settings .paper_directory` .
779
+ Indexes are made by reading files in the ` IndexSettings .paper_directory` .
776
780
By default, we recursively read from subdirectories of the paper directory,
777
- unless disabled using ` Settings.index_recursively ` .
781
+ unless disabled using ` IndexSettings.recurse_subdirectories ` .
778
782
The paper directory is not modified in any way, it's just read from.
779
783
780
784
[ home dir ] : https://docs.python.org/3/library/pathlib.html#pathlib.Path.home
@@ -800,7 +804,7 @@ which also works when called on `DocDetails`.
800
804
### Reusing Index
801
805
802
806
The local search indexes are built based on a hash of the current ` Settings ` object.
803
- So make sure you properly specify the ` paper_directory ` to your ` Settings ` object.
807
+ So make sure you properly specify the ` paper_directory ` to your ` IndexSettings ` object.
804
808
In general, it's advisable to:
805
809
806
810
1 . Pre-build an index given a folder of papers (can take several minutes)
@@ -815,7 +819,7 @@ from paperqa.agents.search import get_directory_index
815
819
816
820
817
821
async def amain (folder_of_papers : str | os.PathLike) -> None :
818
- settings = Settings(paper_directory = folder_of_papers)
822
+ settings = Settings(agent = { " index " : { " paper_directory " : folder_of_papers}} )
819
823
820
824
# 1. Build the index. Note an index name is autogenerated when unspecified
821
825
built_index = await get_directory_index(settings = settings)
@@ -947,7 +951,6 @@ will return much faster than the first query and we'll be certain the authors ma
947
951
| ` agent.return_paper_metadata ` | ` False ` | Whether to include paper title/year in search tool results. |
948
952
| ` agent.search_count ` | ` 8 ` | Search count. |
949
953
| ` agent.timeout ` | ` 500.0 ` | Timeout on agent execution (seconds). |
950
- | ` agent.should_pre_search ` | ` False ` | Whether to run search tool before invoking agent. |
951
954
| ` agent.tool_names ` | ` None ` | Optional override on tools to provide the agent. |
952
955
| ` agent.max_timesteps ` | ` None ` | Optional upper limit on environment steps. |
953
956
| ` agent.index.name ` | ` None ` | Optional name of the index. |
0 commit comments