aiagents4pharma 1.37.0__py3-none-any.whl → 1.38.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. aiagents4pharma/talk2scholars/configs/tools/zotero_read/default.yaml +1 -0
  2. aiagents4pharma/talk2scholars/state/state_talk2scholars.py +33 -7
  3. aiagents4pharma/talk2scholars/tests/test_question_and_answer_tool.py +59 -3
  4. aiagents4pharma/talk2scholars/tests/test_read_helper_utils.py +110 -0
  5. aiagents4pharma/talk2scholars/tests/test_s2_display.py +20 -1
  6. aiagents4pharma/talk2scholars/tests/test_s2_query.py +17 -0
  7. aiagents4pharma/talk2scholars/tests/test_state.py +25 -1
  8. aiagents4pharma/talk2scholars/tests/test_zotero_pdf_downloader_utils.py +46 -0
  9. aiagents4pharma/talk2scholars/tests/test_zotero_read.py +35 -40
  10. aiagents4pharma/talk2scholars/tools/pdf/question_and_answer.py +62 -40
  11. aiagents4pharma/talk2scholars/tools/s2/display_dataframe.py +6 -2
  12. aiagents4pharma/talk2scholars/tools/s2/multi_paper_rec.py +2 -1
  13. aiagents4pharma/talk2scholars/tools/s2/query_dataframe.py +7 -3
  14. aiagents4pharma/talk2scholars/tools/s2/search.py +2 -1
  15. aiagents4pharma/talk2scholars/tools/s2/single_paper_rec.py +2 -1
  16. aiagents4pharma/talk2scholars/tools/zotero/utils/read_helper.py +79 -136
  17. aiagents4pharma/talk2scholars/tools/zotero/utils/zotero_pdf_downloader.py +147 -0
  18. aiagents4pharma/talk2scholars/tools/zotero/zotero_read.py +42 -9
  19. {aiagents4pharma-1.37.0.dist-info → aiagents4pharma-1.38.0.dist-info}/METADATA +1 -1
  20. {aiagents4pharma-1.37.0.dist-info → aiagents4pharma-1.38.0.dist-info}/RECORD +23 -20
  21. {aiagents4pharma-1.37.0.dist-info → aiagents4pharma-1.38.0.dist-info}/WHEEL +1 -1
  22. {aiagents4pharma-1.37.0.dist-info → aiagents4pharma-1.38.0.dist-info}/licenses/LICENSE +0 -0
  23. {aiagents4pharma-1.37.0.dist-info → aiagents4pharma-1.38.0.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  """
4
- This tool is used to search for papers in Zotero library.
4
+ Zotero Read Tool
5
+
6
+ This LangGraph tool searches a user's Zotero library for items matching a query
7
+ and optionally downloads their PDF attachments. It returns structured metadata
8
+ for each found item and makes the results available as an artifact.
5
9
  """
6
10
 
7
11
  import logging
@@ -20,7 +24,15 @@ logger = logging.getLogger(__name__)
20
24
 
21
25
 
22
26
  class ZoteroSearchInput(BaseModel):
23
- """Input schema for the Zotero search tool."""
27
+ """Input schema for the Zotero search tool.
28
+
29
+ Attributes:
30
+ query (str): Search string to match against item metadata.
31
+ only_articles (bool): If True, restrict results to 'journalArticle' and similar types.
32
+ limit (int): Maximum number of items to fetch from Zotero.
33
+ download_pdfs (bool): If True, download PDF attachments for each item.
34
+ tool_call_id (str): Internal identifier for this tool invocation.
35
+ """
24
36
 
25
37
  query: str = Field(
26
38
  description="Search query string to find papers in Zotero library."
@@ -32,6 +44,10 @@ class ZoteroSearchInput(BaseModel):
32
44
  limit: int = Field(
33
45
  default=2, description="Maximum number of results to return", ge=1, le=100
34
46
  )
47
+ download_pdfs: bool = Field(
48
+ default=False,
49
+ description="Whether to download PDF attachments immediately (default True).",
50
+ )
35
51
  tool_call_id: Annotated[str, InjectedToolCallId]
36
52
 
37
53
 
@@ -41,20 +57,36 @@ def zotero_read(
41
57
  only_articles: bool,
42
58
  tool_call_id: Annotated[str, InjectedToolCallId],
43
59
  limit: int = 2,
60
+ download_pdfs: bool = False,
44
61
  ) -> Command[Any]:
45
62
  """
46
- Use this tool to search and retrieve papers from Zotero library.
63
+ Execute a search on the Zotero library and return matching items.
47
64
 
48
65
  Args:
49
- query (str): The search query string to find papers.
50
- tool_call_id (Annotated[str, InjectedToolCallId]): The tool call ID.
51
- limit (int, optional): The maximum number of results to return. Defaults to 2.
66
+ query (str): Text query to search in titles, abstracts, tags, etc.
67
+ only_articles (bool): When True, only include items of type 'journalArticle'
68
+ or 'conferencePaper'.
69
+ tool_call_id (str): Internal ID injected by LangGraph to track this tool call.
70
+ limit (int, optional): Max number of items to return (1–100). Defaults to 2.
71
+ download_pdfs (bool, optional): If True, PDFs for each returned item will be downloaded now.
72
+ If False, only metadata is fetched. Defaults to False.
52
73
 
53
74
  Returns:
54
- Dict[str, Any]: The search results and related information.
75
+ Command[Any]: A LangGraph Command updating the agent state:
76
+ - 'article_data': dict mapping item keys to metadata (and 'pdf_url' if downloaded).
77
+ - 'last_displayed_papers': identifier pointing to the articles in state.
78
+ - 'messages': list containing a ToolMessage with a human-readable summary
79
+ and an 'artifact' referencing the raw article_data.
55
80
  """
56
81
  # Create search data object to organize variables
57
- search_data = ZoteroSearchData(query, only_articles, limit, tool_call_id)
82
+ # download_pdfs flag controls whether PDFs are fetched now or deferred
83
+ search_data = ZoteroSearchData(
84
+ query=query,
85
+ only_articles=only_articles,
86
+ limit=limit,
87
+ download_pdfs=download_pdfs,
88
+ tool_call_id=tool_call_id,
89
+ )
58
90
 
59
91
  # Process the search
60
92
  search_data.process_search()
@@ -63,7 +95,8 @@ def zotero_read(
63
95
  return Command(
64
96
  update={
65
97
  "article_data": results["article_data"],
66
- "last_displayed_papers": "article_data",
98
+ # Store the latest article_data mapping directly for display
99
+ "last_displayed_papers": results["article_data"],
67
100
  "messages": [
68
101
  ToolMessage(
69
102
  content=results["content"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiagents4pharma
3
- Version: 1.37.0
3
+ Version: 1.38.0
4
4
  Summary: AI Agents for drug discovery, drug development, and other pharmaceutical R&D.
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -178,59 +178,62 @@ aiagents4pharma/talk2scholars/configs/tools/search/default.yaml,sha256=RlORkZFLD
178
178
  aiagents4pharma/talk2scholars/configs/tools/single_paper_recommendation/__init__.py,sha256=fqQQ-GlRcbzru2KmEk3oMma0R6_SzGM8dOXzYeU4oVA,46
179
179
  aiagents4pharma/talk2scholars/configs/tools/single_paper_recommendation/default.yaml,sha256=PFXz5oRpNbjQp789QlgmyXktdVWwwVfoYi7mAnlRgik,785
180
180
  aiagents4pharma/talk2scholars/configs/tools/zotero_read/__init__.py,sha256=fqQQ-GlRcbzru2KmEk3oMma0R6_SzGM8dOXzYeU4oVA,46
181
- aiagents4pharma/talk2scholars/configs/tools/zotero_read/default.yaml,sha256=ifOtX8Huj1LPHF_rRe1JxWgrDaLiKg6HVoQen_1R1Ls,1223
181
+ aiagents4pharma/talk2scholars/configs/tools/zotero_read/default.yaml,sha256=Vbu67JYcKvXzcUFOVW-C8Rve2tbmnQz_xmlkbmE6kC8,1294
182
182
  aiagents4pharma/talk2scholars/configs/tools/zotero_write/__inti__.py,sha256=fqQQ-GlRcbzru2KmEk3oMma0R6_SzGM8dOXzYeU4oVA,46
183
183
  aiagents4pharma/talk2scholars/configs/tools/zotero_write/default.yaml,sha256=gB7y7pznviQUzu49Eu4ONNkjQjT8wPKNSw6S_vfd9kI,1222
184
184
  aiagents4pharma/talk2scholars/state/__init__.py,sha256=ReScKLpEvedq4P6ww52NRQS0Xr6SSQV7hqoQ83Mt75U,138
185
- aiagents4pharma/talk2scholars/state/state_talk2scholars.py,sha256=MGB-rWjbOpLN-pK3nY9YKAuskcjeR62rjXbZl1Ppjas,2836
185
+ aiagents4pharma/talk2scholars/state/state_talk2scholars.py,sha256=Z2zV-SXB2SMnn8PnjWjmK-OD5KjUwMTChBpXBAcl2hg,3885
186
186
  aiagents4pharma/talk2scholars/tests/__init__.py,sha256=U3PsTiUZaUBD1IZanFGkDIOdFieDVJtGKQ5-woYUo8c,45
187
187
  aiagents4pharma/talk2scholars/tests/test_llm_main_integration.py,sha256=FBRqS06IKJYFOudQEHQr-9oJ4tftkH-gTCowTAqwWSg,3686
188
188
  aiagents4pharma/talk2scholars/tests/test_main_agent.py,sha256=IZYSocYVwqPil2lF6L07mKm8PUq7vjopmqNiCm6IJEA,6876
189
189
  aiagents4pharma/talk2scholars/tests/test_paper_download_agent.py,sha256=gKSQp-sw62FplNnGYW0wv2ZIUEefh3o0tFWbRzy9yLs,5068
190
190
  aiagents4pharma/talk2scholars/tests/test_paper_download_tools.py,sha256=3mycLeEgH5XkwxuoXfTpQb8c8xFtIX2HjVnACPrSf60,7141
191
191
  aiagents4pharma/talk2scholars/tests/test_pdf_agent.py,sha256=scGCTgka2JuoUhzZwzDn0OgIYihOLhXbwb5uGFR02aI,4302
192
- aiagents4pharma/talk2scholars/tests/test_question_and_answer_tool.py,sha256=_zzg4_XVVEuvYDsJ5la0kFLf9dT45P67-UnUZWDUkhY,34874
192
+ aiagents4pharma/talk2scholars/tests/test_question_and_answer_tool.py,sha256=KR4GjjGgBjWXwEVzSh4ZpYjcWPq-EaZTT_fzRheb0uY,37286
193
+ aiagents4pharma/talk2scholars/tests/test_read_helper_utils.py,sha256=yTT1aLpTydDSdGcRZur5cMktwYZbFK5NEUgOBvltcWg,3819
193
194
  aiagents4pharma/talk2scholars/tests/test_routing_logic.py,sha256=g79tG68ZrUOL3-duCCJwvFK6OieR5KedRf3yTUDqIFk,2784
194
195
  aiagents4pharma/talk2scholars/tests/test_s2_agent.py,sha256=xvlPU4Lz_DdQLTpdtoHW9l_AMvFrzC-FXE5royGbtLM,7806
195
- aiagents4pharma/talk2scholars/tests/test_s2_display.py,sha256=TfJE74KsocAHLbitMLjVrfUwAwyIYpzEvkdrQMBzM2g,2263
196
+ aiagents4pharma/talk2scholars/tests/test_s2_display.py,sha256=Q1q0TEavO2kkXBjo2yeSbzV7xHspnDSvTveaUB-NkQE,3116
196
197
  aiagents4pharma/talk2scholars/tests/test_s2_multi.py,sha256=VCTfexhtX7FgWOBS0YtSm1zghbByZnni1NBLGVTJVGI,11166
197
- aiagents4pharma/talk2scholars/tests/test_s2_query.py,sha256=_pDVolOmhrjZnh37Ig97-LcDHUe0lm3GvTWjNDKgMkc,2461
198
+ aiagents4pharma/talk2scholars/tests/test_s2_query.py,sha256=8Em_bcexpv3odC20TRPi6eoz-6fPXGKabob1Ye0jdsg,3286
198
199
  aiagents4pharma/talk2scholars/tests/test_s2_retrieve.py,sha256=YtA2nbPRtoSR7mPqEjqLF5ERGVzTfeULztsNoCI48X8,2003
199
200
  aiagents4pharma/talk2scholars/tests/test_s2_search.py,sha256=mCGpoCYVn0SJ9BPcEjTz2MLy_K2XJIxvPngwsMoKijA,9945
200
201
  aiagents4pharma/talk2scholars/tests/test_s2_single.py,sha256=KjSh7V2cl1IuO_M9O6dj0vnMHr13H-xKxia_ZgT4qag,10313
201
- aiagents4pharma/talk2scholars/tests/test_state.py,sha256=_iHXvoZnU_eruf8l1sQKBSCIVnxNkH_9VzkVtZZA6bY,384
202
+ aiagents4pharma/talk2scholars/tests/test_state.py,sha256=A2lqA4h37QptLnwKWwm1Y79yELE4wtEBXzCiQ13YdLw,1270
202
203
  aiagents4pharma/talk2scholars/tests/test_zotero_agent.py,sha256=jFEtfQVEwEQ6v3kq7A1_p2MKCu5wbtX47V4bE-fKD6M,6158
203
204
  aiagents4pharma/talk2scholars/tests/test_zotero_human_in_the_loop.py,sha256=YelLQu9Y_r1SNQsC1xoLHJoJ3soIZtBt1MFbbNhY-Dg,10744
204
205
  aiagents4pharma/talk2scholars/tests/test_zotero_path.py,sha256=Ko0HyXCrpm-vs8Bkf-syxp3MfL1IvZwXXgPExyQy_F8,18618
205
- aiagents4pharma/talk2scholars/tests/test_zotero_read.py,sha256=yQTksJhqW036Scs7pnc_bBC23N210mcjaZ6sJZl8QnM,29492
206
+ aiagents4pharma/talk2scholars/tests/test_zotero_pdf_downloader_utils.py,sha256=N9CBRG0rQyqptKRCaYCH2VJk87O-wc9Cc1KI5MMnyjA,1670
207
+ aiagents4pharma/talk2scholars/tests/test_zotero_read.py,sha256=E7ncgspEzhJTvmZuKplugZJPPWsoiFU_xLUg-oz6qkI,29100
206
208
  aiagents4pharma/talk2scholars/tests/test_zotero_write.py,sha256=qWlO0XoZJ6vxUxgisjYv9Np87CoTEDxiQBEOhdj9foo,6111
207
209
  aiagents4pharma/talk2scholars/tools/__init__.py,sha256=c8pYHDqR9P0Frz2jWjbvyizfSTBMlMFzGsiQzx2KC9c,189
208
210
  aiagents4pharma/talk2scholars/tools/paper_download/__init__.py,sha256=tNTLSPNdir4XSKRF0HjXI_tBGBXXXwDhWRI5VnwbZpM,214
209
211
  aiagents4pharma/talk2scholars/tools/paper_download/download_arxiv_input.py,sha256=WTWvXbh0C96OoMoPf8Bgu0AgorsdkWslac_WqlHc4bo,3900
210
212
  aiagents4pharma/talk2scholars/tools/pdf/__init__.py,sha256=DPpOfON3AySko5EBBAe_3udOoSaAdQWNyGeNvJyV5R8,138
211
- aiagents4pharma/talk2scholars/tools/pdf/question_and_answer.py,sha256=RfICBn4VorvpTrb_GunFFAi6fnzUlees_k0poQm0VKc,21853
213
+ aiagents4pharma/talk2scholars/tools/pdf/question_and_answer.py,sha256=_G5M39iHWPMOBbnmF6z46_JkaF9sCV8CQiD8vQYVmVY,22956
212
214
  aiagents4pharma/talk2scholars/tools/s2/__init__.py,sha256=w_eiw0pG8HNp79F9O_icXs_Yl_4odsmagYNKDTjIsvk,428
213
- aiagents4pharma/talk2scholars/tools/s2/display_dataframe.py,sha256=YtnCrI0c3Fhi68R6ndPUnVM3E5u7CuBB_myIzLN6nXg,3040
214
- aiagents4pharma/talk2scholars/tools/s2/multi_paper_rec.py,sha256=N6GwG3oCQFEcntpjTQObAELzM5OpZq0u9J9-gUWU2kc,2716
215
- aiagents4pharma/talk2scholars/tools/s2/query_dataframe.py,sha256=inaWWctaylJAJsXinQA63qPs5n-gn7axJz8ijj66Jmw,2746
215
+ aiagents4pharma/talk2scholars/tools/s2/display_dataframe.py,sha256=wOZ7UJq4b8vl7NU9mU3BW_nRmCIkeBvc6nbGGegysek,3181
216
+ aiagents4pharma/talk2scholars/tools/s2/multi_paper_rec.py,sha256=N7-6dzRI71bK7MG3-A4G505YnNvAMJW_Qjjtcoo4JYw,2799
217
+ aiagents4pharma/talk2scholars/tools/s2/query_dataframe.py,sha256=uI6-UnZu96Uirzohx-F7vMHOVSPlPrD4XJdwgF5GcMo,2866
216
218
  aiagents4pharma/talk2scholars/tools/s2/retrieve_semantic_scholar_paper_id.py,sha256=llzMMnEQKeYVamJbF4_DTMx-BgVe79vwDcUIFGLrmUY,2615
217
- aiagents4pharma/talk2scholars/tools/s2/search.py,sha256=NGzo1rF5VJJuZJbSLDwy2f220wSh7DWEw6xT1qQA2V0,2452
218
- aiagents4pharma/talk2scholars/tools/s2/single_paper_rec.py,sha256=7VivBGHcmaJZN7v7gYwddC-rfrDHaZo74pSNBYlJ2xU,2673
219
+ aiagents4pharma/talk2scholars/tools/s2/search.py,sha256=p86RLy_9bMxm3KTDL2L0Ilb3yeF4K6IIkZCgbt4CsiE,2529
220
+ aiagents4pharma/talk2scholars/tools/s2/single_paper_rec.py,sha256=rnl6Bb7mKXg_lsProAYaSEJNIzWgNVZuDHqD-dDe9EI,2763
219
221
  aiagents4pharma/talk2scholars/tools/s2/utils/__init__.py,sha256=wBTPVgiXbmIJUMouOQRwojgk5PJXeEinDJzHzEToZbU,229
220
222
  aiagents4pharma/talk2scholars/tools/s2/utils/multi_helper.py,sha256=rrR0DRNeGHpYcONZS7oS-VCSWBL5zNALU4m7IF6Yxng,7268
221
223
  aiagents4pharma/talk2scholars/tools/s2/utils/search_helper.py,sha256=_eP7q4ZTSWisEF4Stffe-IpR2MD9WrQ0u3jbbeJBRLU,6363
222
224
  aiagents4pharma/talk2scholars/tools/s2/utils/single_helper.py,sha256=ahTDT0lp5VRZS5hLL3-hsHx4wB3LUVY2OBTCTEJyR3Y,6983
223
225
  aiagents4pharma/talk2scholars/tools/zotero/__init__.py,sha256=wXiQILLq-utV35PkDUpm_F074mG9yRMyGQAFlr9UAOw,197
224
- aiagents4pharma/talk2scholars/tools/zotero/zotero_read.py,sha256=RqFXP2DXmkHLhVLirrTnmSk-E8Jipi4ue_Zw65npbnM,2263
226
+ aiagents4pharma/talk2scholars/tools/zotero/zotero_read.py,sha256=Fgv7PIkIlRqfl8EprcXqr1S4wtbSG8itv7x-3nMf3Rc,3990
225
227
  aiagents4pharma/talk2scholars/tools/zotero/zotero_review.py,sha256=iqwpolg7GWAjXizubLrPaAsgOpsOhKz-tFRyLOiBvC0,6325
226
228
  aiagents4pharma/talk2scholars/tools/zotero/zotero_write.py,sha256=KnDcnUBB0lwMcxNpC3hsVnICWkj23MDAePdHlK-Kekk,3024
227
229
  aiagents4pharma/talk2scholars/tools/zotero/utils/__init__.py,sha256=uIyKZSFB07-zd3vjS9ABL0r6fdBX9JHw60j8oUfxHQs,209
228
- aiagents4pharma/talk2scholars/tools/zotero/utils/read_helper.py,sha256=lyrfpx8NHYiAN1qQSJWqPka7cML5BASwRXaI66fb-u8,13662
230
+ aiagents4pharma/talk2scholars/tools/zotero/utils/read_helper.py,sha256=54SO05iuJ2VHLJ1d4b16oh5b5VCp2-nB1nT5eOCHb-g,11712
229
231
  aiagents4pharma/talk2scholars/tools/zotero/utils/review_helper.py,sha256=IPD1V9yrBYaDnRe7sR6PrpwR82OBJbA2P_Tc6RbxAbM,2748
230
232
  aiagents4pharma/talk2scholars/tools/zotero/utils/write_helper.py,sha256=ALwLecy1QVebbsmXJiDj1GhGmyhq2R2tZlAyEl1vfhw,7410
231
233
  aiagents4pharma/talk2scholars/tools/zotero/utils/zotero_path.py,sha256=oIrfbOySgts50ksHKyjcWjRkPRIS88g3Lc0v9mBkU8w,6375
232
- aiagents4pharma-1.37.0.dist-info/licenses/LICENSE,sha256=IcIbyB1Hyk5ZDah03VNQvJkbNk2hkBCDqQ8qtnCvB4Q,1077
233
- aiagents4pharma-1.37.0.dist-info/METADATA,sha256=F-uncJSmjQ9bOlTHKuLJMa311nbF90UL7aJXwn2zVe0,16788
234
- aiagents4pharma-1.37.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
235
- aiagents4pharma-1.37.0.dist-info/top_level.txt,sha256=-AH8rMmrSnJtq7HaAObS78UU-cTCwvX660dSxeM7a0A,16
236
- aiagents4pharma-1.37.0.dist-info/RECORD,,
234
+ aiagents4pharma/talk2scholars/tools/zotero/utils/zotero_pdf_downloader.py,sha256=ERBha8afU6Q1EaRBe9qB8tchOzZ4_KfFgDW6EElOJoU,4816
235
+ aiagents4pharma-1.38.0.dist-info/licenses/LICENSE,sha256=IcIbyB1Hyk5ZDah03VNQvJkbNk2hkBCDqQ8qtnCvB4Q,1077
236
+ aiagents4pharma-1.38.0.dist-info/METADATA,sha256=pHbuNJmxv1gfi0JcUnBxOMTcniqA4rMFEJfqgzwLFjw,16788
237
+ aiagents4pharma-1.38.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
238
+ aiagents4pharma-1.38.0.dist-info/top_level.txt,sha256=-AH8rMmrSnJtq7HaAObS78UU-cTCwvX660dSxeM7a0A,16
239
+ aiagents4pharma-1.38.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5