aiagents4pharma 1.43.0__py3-none-any.whl → 1.45.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 (290) hide show
  1. aiagents4pharma/__init__.py +2 -2
  2. aiagents4pharma/talk2aiagents4pharma/.dockerignore +13 -0
  3. aiagents4pharma/talk2aiagents4pharma/Dockerfile +105 -0
  4. aiagents4pharma/talk2aiagents4pharma/README.md +1 -0
  5. aiagents4pharma/talk2aiagents4pharma/__init__.py +4 -5
  6. aiagents4pharma/talk2aiagents4pharma/agents/__init__.py +3 -2
  7. aiagents4pharma/talk2aiagents4pharma/agents/main_agent.py +24 -23
  8. aiagents4pharma/talk2aiagents4pharma/configs/__init__.py +2 -2
  9. aiagents4pharma/talk2aiagents4pharma/configs/agents/__init__.py +2 -2
  10. aiagents4pharma/talk2aiagents4pharma/configs/agents/main_agent/default.yaml +2 -2
  11. aiagents4pharma/talk2aiagents4pharma/configs/config.yaml +1 -1
  12. aiagents4pharma/talk2aiagents4pharma/docker-compose/cpu/.env.example +23 -0
  13. aiagents4pharma/talk2aiagents4pharma/docker-compose/cpu/docker-compose.yml +93 -0
  14. aiagents4pharma/talk2aiagents4pharma/docker-compose/gpu/.env.example +23 -0
  15. aiagents4pharma/talk2aiagents4pharma/docker-compose/gpu/docker-compose.yml +108 -0
  16. aiagents4pharma/talk2aiagents4pharma/install.md +127 -0
  17. aiagents4pharma/talk2aiagents4pharma/states/__init__.py +3 -2
  18. aiagents4pharma/talk2aiagents4pharma/states/state_talk2aiagents4pharma.py +5 -3
  19. aiagents4pharma/talk2aiagents4pharma/tests/__init__.py +2 -2
  20. aiagents4pharma/talk2aiagents4pharma/tests/test_main_agent.py +72 -50
  21. aiagents4pharma/talk2biomodels/.dockerignore +13 -0
  22. aiagents4pharma/talk2biomodels/Dockerfile +104 -0
  23. aiagents4pharma/talk2biomodels/README.md +1 -0
  24. aiagents4pharma/talk2biomodels/__init__.py +4 -8
  25. aiagents4pharma/talk2biomodels/agents/__init__.py +3 -2
  26. aiagents4pharma/talk2biomodels/agents/t2b_agent.py +47 -42
  27. aiagents4pharma/talk2biomodels/api/__init__.py +4 -5
  28. aiagents4pharma/talk2biomodels/api/kegg.py +14 -10
  29. aiagents4pharma/talk2biomodels/api/ols.py +13 -10
  30. aiagents4pharma/talk2biomodels/api/uniprot.py +7 -6
  31. aiagents4pharma/talk2biomodels/configs/__init__.py +3 -4
  32. aiagents4pharma/talk2biomodels/configs/agents/__init__.py +2 -2
  33. aiagents4pharma/talk2biomodels/configs/agents/t2b_agent/__init__.py +2 -2
  34. aiagents4pharma/talk2biomodels/configs/agents/t2b_agent/default.yaml +1 -1
  35. aiagents4pharma/talk2biomodels/configs/config.yaml +1 -1
  36. aiagents4pharma/talk2biomodels/configs/tools/__init__.py +4 -5
  37. aiagents4pharma/talk2biomodels/configs/tools/ask_question/__init__.py +2 -2
  38. aiagents4pharma/talk2biomodels/configs/tools/ask_question/default.yaml +1 -2
  39. aiagents4pharma/talk2biomodels/configs/tools/custom_plotter/__init__.py +2 -2
  40. aiagents4pharma/talk2biomodels/configs/tools/custom_plotter/default.yaml +1 -1
  41. aiagents4pharma/talk2biomodels/configs/tools/get_annotation/__init__.py +2 -2
  42. aiagents4pharma/talk2biomodels/configs/tools/get_annotation/default.yaml +1 -1
  43. aiagents4pharma/talk2biomodels/install.md +63 -0
  44. aiagents4pharma/talk2biomodels/models/__init__.py +4 -4
  45. aiagents4pharma/talk2biomodels/models/basico_model.py +36 -28
  46. aiagents4pharma/talk2biomodels/models/sys_bio_model.py +13 -10
  47. aiagents4pharma/talk2biomodels/states/__init__.py +3 -2
  48. aiagents4pharma/talk2biomodels/states/state_talk2biomodels.py +12 -8
  49. aiagents4pharma/talk2biomodels/tests/BIOMD0000000449_url.xml +1585 -0
  50. aiagents4pharma/talk2biomodels/tests/__init__.py +2 -2
  51. aiagents4pharma/talk2biomodels/tests/article_on_model_537.pdf +0 -0
  52. aiagents4pharma/talk2biomodels/tests/test_api.py +18 -14
  53. aiagents4pharma/talk2biomodels/tests/test_ask_question.py +8 -9
  54. aiagents4pharma/talk2biomodels/tests/test_basico_model.py +15 -9
  55. aiagents4pharma/talk2biomodels/tests/test_get_annotation.py +54 -55
  56. aiagents4pharma/talk2biomodels/tests/test_getmodelinfo.py +28 -27
  57. aiagents4pharma/talk2biomodels/tests/test_integration.py +21 -33
  58. aiagents4pharma/talk2biomodels/tests/test_load_biomodel.py +14 -11
  59. aiagents4pharma/talk2biomodels/tests/test_param_scan.py +21 -20
  60. aiagents4pharma/talk2biomodels/tests/test_query_article.py +129 -29
  61. aiagents4pharma/talk2biomodels/tests/test_search_models.py +9 -13
  62. aiagents4pharma/talk2biomodels/tests/test_simulate_model.py +16 -15
  63. aiagents4pharma/talk2biomodels/tests/test_steady_state.py +12 -22
  64. aiagents4pharma/talk2biomodels/tests/test_sys_bio_model.py +33 -29
  65. aiagents4pharma/talk2biomodels/tools/__init__.py +15 -12
  66. aiagents4pharma/talk2biomodels/tools/ask_question.py +42 -32
  67. aiagents4pharma/talk2biomodels/tools/custom_plotter.py +51 -43
  68. aiagents4pharma/talk2biomodels/tools/get_annotation.py +99 -75
  69. aiagents4pharma/talk2biomodels/tools/get_modelinfo.py +57 -51
  70. aiagents4pharma/talk2biomodels/tools/load_arguments.py +52 -32
  71. aiagents4pharma/talk2biomodels/tools/load_biomodel.py +8 -2
  72. aiagents4pharma/talk2biomodels/tools/parameter_scan.py +107 -90
  73. aiagents4pharma/talk2biomodels/tools/query_article.py +14 -13
  74. aiagents4pharma/talk2biomodels/tools/search_models.py +37 -26
  75. aiagents4pharma/talk2biomodels/tools/simulate_model.py +47 -37
  76. aiagents4pharma/talk2biomodels/tools/steady_state.py +76 -58
  77. aiagents4pharma/talk2biomodels/tools/utils.py +4 -3
  78. aiagents4pharma/talk2cells/README.md +1 -0
  79. aiagents4pharma/talk2cells/__init__.py +4 -5
  80. aiagents4pharma/talk2cells/agents/__init__.py +3 -2
  81. aiagents4pharma/talk2cells/agents/scp_agent.py +21 -19
  82. aiagents4pharma/talk2cells/states/__init__.py +3 -2
  83. aiagents4pharma/talk2cells/states/state_talk2cells.py +4 -2
  84. aiagents4pharma/talk2cells/tests/scp_agent/test_scp_agent.py +8 -9
  85. aiagents4pharma/talk2cells/tools/__init__.py +3 -2
  86. aiagents4pharma/talk2cells/tools/scp_agent/__init__.py +4 -4
  87. aiagents4pharma/talk2cells/tools/scp_agent/display_studies.py +5 -3
  88. aiagents4pharma/talk2cells/tools/scp_agent/search_studies.py +21 -22
  89. aiagents4pharma/talk2knowledgegraphs/.dockerignore +13 -0
  90. aiagents4pharma/talk2knowledgegraphs/Dockerfile +103 -0
  91. aiagents4pharma/talk2knowledgegraphs/README.md +1 -0
  92. aiagents4pharma/talk2knowledgegraphs/__init__.py +4 -7
  93. aiagents4pharma/talk2knowledgegraphs/agents/__init__.py +3 -2
  94. aiagents4pharma/talk2knowledgegraphs/agents/t2kg_agent.py +40 -30
  95. aiagents4pharma/talk2knowledgegraphs/configs/__init__.py +3 -6
  96. aiagents4pharma/talk2knowledgegraphs/configs/agents/t2kg_agent/__init__.py +2 -2
  97. aiagents4pharma/talk2knowledgegraphs/configs/agents/t2kg_agent/default.yaml +8 -8
  98. aiagents4pharma/talk2knowledgegraphs/configs/app/__init__.py +3 -2
  99. aiagents4pharma/talk2knowledgegraphs/configs/app/frontend/__init__.py +2 -2
  100. aiagents4pharma/talk2knowledgegraphs/configs/app/frontend/default.yaml +1 -1
  101. aiagents4pharma/talk2knowledgegraphs/configs/config.yaml +1 -1
  102. aiagents4pharma/talk2knowledgegraphs/configs/tools/__init__.py +4 -5
  103. aiagents4pharma/talk2knowledgegraphs/configs/tools/graphrag_reasoning/__init__.py +2 -2
  104. aiagents4pharma/talk2knowledgegraphs/configs/tools/graphrag_reasoning/default.yaml +1 -1
  105. aiagents4pharma/talk2knowledgegraphs/configs/tools/multimodal_subgraph_extraction/default.yaml +17 -2
  106. aiagents4pharma/talk2knowledgegraphs/configs/tools/subgraph_extraction/__init__.py +2 -2
  107. aiagents4pharma/talk2knowledgegraphs/configs/tools/subgraph_extraction/default.yaml +1 -1
  108. aiagents4pharma/talk2knowledgegraphs/configs/tools/subgraph_summarization/__init__.py +2 -2
  109. aiagents4pharma/talk2knowledgegraphs/configs/tools/subgraph_summarization/default.yaml +1 -1
  110. aiagents4pharma/talk2knowledgegraphs/configs/utils/enrichments/ols_terms/default.yaml +1 -1
  111. aiagents4pharma/talk2knowledgegraphs/configs/utils/enrichments/reactome_pathways/default.yaml +1 -1
  112. aiagents4pharma/talk2knowledgegraphs/configs/utils/enrichments/uniprot_proteins/default.yaml +1 -1
  113. aiagents4pharma/talk2knowledgegraphs/configs/utils/pubchem_utils/default.yaml +1 -1
  114. aiagents4pharma/talk2knowledgegraphs/datasets/__init__.py +4 -6
  115. aiagents4pharma/talk2knowledgegraphs/datasets/biobridge_primekg.py +115 -67
  116. aiagents4pharma/talk2knowledgegraphs/datasets/dataset.py +2 -0
  117. aiagents4pharma/talk2knowledgegraphs/datasets/primekg.py +35 -24
  118. aiagents4pharma/talk2knowledgegraphs/datasets/starkqa_primekg.py +29 -21
  119. aiagents4pharma/talk2knowledgegraphs/docker-compose/cpu/.env.example +23 -0
  120. aiagents4pharma/talk2knowledgegraphs/docker-compose/cpu/docker-compose.yml +93 -0
  121. aiagents4pharma/talk2knowledgegraphs/docker-compose/gpu/.env.example +23 -0
  122. aiagents4pharma/talk2knowledgegraphs/docker-compose/gpu/docker-compose.yml +108 -0
  123. aiagents4pharma/talk2knowledgegraphs/entrypoint.sh +190 -0
  124. aiagents4pharma/talk2knowledgegraphs/install.md +140 -0
  125. aiagents4pharma/talk2knowledgegraphs/milvus_data_dump.py +31 -65
  126. aiagents4pharma/talk2knowledgegraphs/states/__init__.py +3 -2
  127. aiagents4pharma/talk2knowledgegraphs/states/state_talk2knowledgegraphs.py +1 -0
  128. aiagents4pharma/talk2knowledgegraphs/tests/test_agents_t2kg_agent.py +65 -40
  129. aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_biobridge_primekg.py +54 -48
  130. aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_dataset.py +4 -0
  131. aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_primekg.py +17 -4
  132. aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_starkqa_primekg.py +33 -24
  133. aiagents4pharma/talk2knowledgegraphs/tests/test_tools_graphrag_reasoning.py +116 -69
  134. aiagents4pharma/talk2knowledgegraphs/tests/test_tools_milvus_multimodal_subgraph_extraction.py +736 -413
  135. aiagents4pharma/talk2knowledgegraphs/tests/test_tools_multimodal_subgraph_extraction.py +22 -15
  136. aiagents4pharma/talk2knowledgegraphs/tests/test_tools_subgraph_extraction.py +19 -12
  137. aiagents4pharma/talk2knowledgegraphs/tests/test_tools_subgraph_summarization.py +95 -48
  138. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_embeddings.py +4 -0
  139. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_huggingface.py +5 -0
  140. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_nim_molmim.py +13 -18
  141. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_ollama.py +10 -3
  142. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_enrichments.py +4 -3
  143. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_ollama.py +3 -2
  144. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_ols.py +1 -0
  145. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_pubchem.py +9 -4
  146. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_reactome.py +6 -6
  147. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_uniprot.py +4 -0
  148. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_extractions_milvus_multimodal_pcst.py +442 -42
  149. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_kg_utils.py +3 -4
  150. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_pubchem_utils.py +10 -6
  151. aiagents4pharma/talk2knowledgegraphs/tools/__init__.py +10 -7
  152. aiagents4pharma/talk2knowledgegraphs/tools/graphrag_reasoning.py +15 -20
  153. aiagents4pharma/talk2knowledgegraphs/tools/milvus_multimodal_subgraph_extraction.py +245 -205
  154. aiagents4pharma/talk2knowledgegraphs/tools/multimodal_subgraph_extraction.py +92 -90
  155. aiagents4pharma/talk2knowledgegraphs/tools/subgraph_extraction.py +25 -37
  156. aiagents4pharma/talk2knowledgegraphs/tools/subgraph_summarization.py +10 -13
  157. aiagents4pharma/talk2knowledgegraphs/utils/__init__.py +4 -7
  158. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/__init__.py +4 -7
  159. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/embeddings.py +4 -0
  160. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/huggingface.py +11 -14
  161. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/nim_molmim.py +7 -7
  162. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/ollama.py +12 -6
  163. aiagents4pharma/talk2knowledgegraphs/utils/embeddings/sentence_transformer.py +8 -6
  164. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/__init__.py +9 -6
  165. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/enrichments.py +1 -0
  166. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/ollama.py +15 -9
  167. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/ols_terms.py +23 -20
  168. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/pubchem_strings.py +12 -10
  169. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/reactome_pathways.py +16 -10
  170. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/uniprot_proteins.py +26 -18
  171. aiagents4pharma/talk2knowledgegraphs/utils/extractions/__init__.py +4 -5
  172. aiagents4pharma/talk2knowledgegraphs/utils/extractions/milvus_multimodal_pcst.py +218 -81
  173. aiagents4pharma/talk2knowledgegraphs/utils/extractions/multimodal_pcst.py +53 -47
  174. aiagents4pharma/talk2knowledgegraphs/utils/extractions/pcst.py +18 -14
  175. aiagents4pharma/talk2knowledgegraphs/utils/kg_utils.py +22 -23
  176. aiagents4pharma/talk2knowledgegraphs/utils/pubchem_utils.py +11 -10
  177. aiagents4pharma/talk2scholars/.dockerignore +13 -0
  178. aiagents4pharma/talk2scholars/Dockerfile +104 -0
  179. aiagents4pharma/talk2scholars/README.md +1 -0
  180. aiagents4pharma/talk2scholars/agents/__init__.py +1 -5
  181. aiagents4pharma/talk2scholars/agents/main_agent.py +6 -4
  182. aiagents4pharma/talk2scholars/agents/paper_download_agent.py +5 -4
  183. aiagents4pharma/talk2scholars/agents/pdf_agent.py +4 -2
  184. aiagents4pharma/talk2scholars/agents/s2_agent.py +2 -2
  185. aiagents4pharma/talk2scholars/agents/zotero_agent.py +10 -11
  186. aiagents4pharma/talk2scholars/configs/__init__.py +1 -3
  187. aiagents4pharma/talk2scholars/configs/agents/talk2scholars/__init__.py +1 -4
  188. aiagents4pharma/talk2scholars/configs/agents/talk2scholars/main_agent/default.yaml +1 -1
  189. aiagents4pharma/talk2scholars/configs/agents/talk2scholars/pdf_agent/default.yaml +1 -1
  190. aiagents4pharma/talk2scholars/configs/agents/talk2scholars/s2_agent/default.yaml +8 -8
  191. aiagents4pharma/talk2scholars/configs/agents/talk2scholars/zotero_agent/default.yaml +7 -7
  192. aiagents4pharma/talk2scholars/configs/tools/__init__.py +8 -6
  193. aiagents4pharma/talk2scholars/docker-compose/cpu/.env.example +21 -0
  194. aiagents4pharma/talk2scholars/docker-compose/cpu/docker-compose.yml +90 -0
  195. aiagents4pharma/talk2scholars/docker-compose/gpu/.env.example +21 -0
  196. aiagents4pharma/talk2scholars/docker-compose/gpu/docker-compose.yml +105 -0
  197. aiagents4pharma/talk2scholars/install.md +122 -0
  198. aiagents4pharma/talk2scholars/state/state_talk2scholars.py +8 -8
  199. aiagents4pharma/talk2scholars/tests/{test_main_agent.py → test_agents_main_agent.py} +41 -23
  200. aiagents4pharma/talk2scholars/tests/{test_paper_download_agent.py → test_agents_paper_agents_download_agent.py} +10 -16
  201. aiagents4pharma/talk2scholars/tests/{test_pdf_agent.py → test_agents_pdf_agent.py} +6 -10
  202. aiagents4pharma/talk2scholars/tests/{test_s2_agent.py → test_agents_s2_agent.py} +8 -16
  203. aiagents4pharma/talk2scholars/tests/{test_zotero_agent.py → test_agents_zotero_agent.py} +5 -7
  204. aiagents4pharma/talk2scholars/tests/{test_s2_display_dataframe.py → test_s2_tools_display_dataframe.py} +6 -7
  205. aiagents4pharma/talk2scholars/tests/{test_s2_query_dataframe.py → test_s2_tools_query_dataframe.py} +5 -15
  206. aiagents4pharma/talk2scholars/tests/{test_paper_downloader.py → test_tools_paper_downloader.py} +25 -63
  207. aiagents4pharma/talk2scholars/tests/{test_question_and_answer_tool.py → test_tools_question_and_answer_tool.py} +2 -6
  208. aiagents4pharma/talk2scholars/tests/{test_s2_multi.py → test_tools_s2_multi.py} +5 -5
  209. aiagents4pharma/talk2scholars/tests/{test_s2_retrieve.py → test_tools_s2_retrieve.py} +2 -1
  210. aiagents4pharma/talk2scholars/tests/{test_s2_search.py → test_tools_s2_search.py} +5 -5
  211. aiagents4pharma/talk2scholars/tests/{test_s2_single.py → test_tools_s2_single.py} +5 -5
  212. aiagents4pharma/talk2scholars/tests/{test_arxiv_downloader.py → test_utils_arxiv_downloader.py} +16 -25
  213. aiagents4pharma/talk2scholars/tests/{test_base_paper_downloader.py → test_utils_base_paper_downloader.py} +25 -47
  214. aiagents4pharma/talk2scholars/tests/{test_biorxiv_downloader.py → test_utils_biorxiv_downloader.py} +14 -42
  215. aiagents4pharma/talk2scholars/tests/{test_medrxiv_downloader.py → test_utils_medrxiv_downloader.py} +15 -49
  216. aiagents4pharma/talk2scholars/tests/{test_nvidia_nim_reranker.py → test_utils_nvidia_nim_reranker.py} +6 -16
  217. aiagents4pharma/talk2scholars/tests/{test_pdf_answer_formatter.py → test_utils_pdf_answer_formatter.py} +1 -0
  218. aiagents4pharma/talk2scholars/tests/{test_pdf_batch_processor.py → test_utils_pdf_batch_processor.py} +6 -15
  219. aiagents4pharma/talk2scholars/tests/{test_pdf_collection_manager.py → test_utils_pdf_collection_manager.py} +34 -11
  220. aiagents4pharma/talk2scholars/tests/{test_pdf_document_processor.py → test_utils_pdf_document_processor.py} +2 -3
  221. aiagents4pharma/talk2scholars/tests/{test_pdf_generate_answer.py → test_utils_pdf_generate_answer.py} +3 -6
  222. aiagents4pharma/talk2scholars/tests/{test_pdf_gpu_detection.py → test_utils_pdf_gpu_detection.py} +5 -16
  223. aiagents4pharma/talk2scholars/tests/{test_pdf_rag_pipeline.py → test_utils_pdf_rag_pipeline.py} +7 -17
  224. aiagents4pharma/talk2scholars/tests/{test_pdf_retrieve_chunks.py → test_utils_pdf_retrieve_chunks.py} +4 -11
  225. aiagents4pharma/talk2scholars/tests/{test_pdf_singleton_manager.py → test_utils_pdf_singleton_manager.py} +26 -23
  226. aiagents4pharma/talk2scholars/tests/{test_pdf_vector_normalization.py → test_utils_pdf_vector_normalization.py} +1 -1
  227. aiagents4pharma/talk2scholars/tests/{test_pdf_vector_store.py → test_utils_pdf_vector_store.py} +27 -55
  228. aiagents4pharma/talk2scholars/tests/{test_pubmed_downloader.py → test_utils_pubmed_downloader.py} +31 -91
  229. aiagents4pharma/talk2scholars/tests/{test_read_helper_utils.py → test_utils_read_helper_utils.py} +2 -6
  230. aiagents4pharma/talk2scholars/tests/{test_s2_utils_ext_ids.py → test_utils_s2_utils_ext_ids.py} +5 -15
  231. aiagents4pharma/talk2scholars/tests/{test_zotero_human_in_the_loop.py → test_utils_zotero_human_in_the_loop.py} +6 -13
  232. aiagents4pharma/talk2scholars/tests/{test_zotero_path.py → test_utils_zotero_path.py} +53 -45
  233. aiagents4pharma/talk2scholars/tests/{test_zotero_read.py → test_utils_zotero_read.py} +30 -91
  234. aiagents4pharma/talk2scholars/tests/{test_zotero_write.py → test_utils_zotero_write.py} +6 -16
  235. aiagents4pharma/talk2scholars/tools/__init__.py +1 -4
  236. aiagents4pharma/talk2scholars/tools/paper_download/paper_downloader.py +20 -35
  237. aiagents4pharma/talk2scholars/tools/paper_download/utils/__init__.py +7 -5
  238. aiagents4pharma/talk2scholars/tools/paper_download/utils/arxiv_downloader.py +9 -11
  239. aiagents4pharma/talk2scholars/tools/paper_download/utils/base_paper_downloader.py +14 -21
  240. aiagents4pharma/talk2scholars/tools/paper_download/utils/biorxiv_downloader.py +14 -22
  241. aiagents4pharma/talk2scholars/tools/paper_download/utils/medrxiv_downloader.py +11 -13
  242. aiagents4pharma/talk2scholars/tools/paper_download/utils/pubmed_downloader.py +14 -28
  243. aiagents4pharma/talk2scholars/tools/pdf/question_and_answer.py +4 -8
  244. aiagents4pharma/talk2scholars/tools/pdf/utils/__init__.py +16 -14
  245. aiagents4pharma/talk2scholars/tools/pdf/utils/answer_formatter.py +4 -4
  246. aiagents4pharma/talk2scholars/tools/pdf/utils/batch_processor.py +15 -17
  247. aiagents4pharma/talk2scholars/tools/pdf/utils/collection_manager.py +2 -2
  248. aiagents4pharma/talk2scholars/tools/pdf/utils/document_processor.py +5 -5
  249. aiagents4pharma/talk2scholars/tools/pdf/utils/generate_answer.py +4 -4
  250. aiagents4pharma/talk2scholars/tools/pdf/utils/get_vectorstore.py +2 -6
  251. aiagents4pharma/talk2scholars/tools/pdf/utils/gpu_detection.py +5 -9
  252. aiagents4pharma/talk2scholars/tools/pdf/utils/nvidia_nim_reranker.py +4 -4
  253. aiagents4pharma/talk2scholars/tools/pdf/utils/paper_loader.py +2 -2
  254. aiagents4pharma/talk2scholars/tools/pdf/utils/rag_pipeline.py +6 -15
  255. aiagents4pharma/talk2scholars/tools/pdf/utils/retrieve_chunks.py +7 -15
  256. aiagents4pharma/talk2scholars/tools/pdf/utils/singleton_manager.py +2 -2
  257. aiagents4pharma/talk2scholars/tools/pdf/utils/tool_helper.py +3 -4
  258. aiagents4pharma/talk2scholars/tools/pdf/utils/vector_normalization.py +8 -17
  259. aiagents4pharma/talk2scholars/tools/pdf/utils/vector_store.py +17 -33
  260. aiagents4pharma/talk2scholars/tools/s2/__init__.py +8 -6
  261. aiagents4pharma/talk2scholars/tools/s2/display_dataframe.py +3 -7
  262. aiagents4pharma/talk2scholars/tools/s2/multi_paper_rec.py +7 -6
  263. aiagents4pharma/talk2scholars/tools/s2/query_dataframe.py +5 -12
  264. aiagents4pharma/talk2scholars/tools/s2/retrieve_semantic_scholar_paper_id.py +2 -4
  265. aiagents4pharma/talk2scholars/tools/s2/search.py +6 -6
  266. aiagents4pharma/talk2scholars/tools/s2/single_paper_rec.py +5 -3
  267. aiagents4pharma/talk2scholars/tools/s2/utils/__init__.py +1 -3
  268. aiagents4pharma/talk2scholars/tools/s2/utils/multi_helper.py +12 -18
  269. aiagents4pharma/talk2scholars/tools/s2/utils/search_helper.py +11 -18
  270. aiagents4pharma/talk2scholars/tools/s2/utils/single_helper.py +11 -16
  271. aiagents4pharma/talk2scholars/tools/zotero/__init__.py +1 -4
  272. aiagents4pharma/talk2scholars/tools/zotero/utils/__init__.py +1 -4
  273. aiagents4pharma/talk2scholars/tools/zotero/utils/read_helper.py +21 -39
  274. aiagents4pharma/talk2scholars/tools/zotero/utils/review_helper.py +2 -6
  275. aiagents4pharma/talk2scholars/tools/zotero/utils/write_helper.py +8 -11
  276. aiagents4pharma/talk2scholars/tools/zotero/utils/zotero_path.py +4 -12
  277. aiagents4pharma/talk2scholars/tools/zotero/utils/zotero_pdf_downloader.py +13 -27
  278. aiagents4pharma/talk2scholars/tools/zotero/zotero_read.py +4 -7
  279. aiagents4pharma/talk2scholars/tools/zotero/zotero_review.py +8 -10
  280. aiagents4pharma/talk2scholars/tools/zotero/zotero_write.py +3 -2
  281. {aiagents4pharma-1.43.0.dist-info → aiagents4pharma-1.45.0.dist-info}/METADATA +115 -50
  282. aiagents4pharma-1.45.0.dist-info/RECORD +324 -0
  283. {aiagents4pharma-1.43.0.dist-info → aiagents4pharma-1.45.0.dist-info}/WHEEL +1 -2
  284. aiagents4pharma-1.43.0.dist-info/RECORD +0 -293
  285. aiagents4pharma-1.43.0.dist-info/top_level.txt +0 -1
  286. /aiagents4pharma/talk2scholars/tests/{test_state.py → test_states_state.py} +0 -0
  287. /aiagents4pharma/talk2scholars/tests/{test_pdf_paper_loader.py → test_utils_pdf_paper_loader.py} +0 -0
  288. /aiagents4pharma/talk2scholars/tests/{test_tool_helper_utils.py → test_utils_tool_helper_utils.py} +0 -0
  289. /aiagents4pharma/talk2scholars/tests/{test_zotero_pdf_downloader_utils.py → test_utils_zotero_pdf_downloader_utils.py} +0 -0
  290. {aiagents4pharma-1.43.0.dist-info → aiagents4pharma-1.45.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,10 +1,11 @@
1
1
  """
2
2
  This module contains the API for fetching uniprot database
3
3
  """
4
- from typing import List, Dict
4
+
5
5
  import requests
6
6
 
7
- def search_uniprot_labels(identifiers: List[str]) -> Dict[str, str]:
7
+
8
+ def search_uniprot_labels(identifiers: list[str]) -> dict[str, str]:
8
9
  """
9
10
  Fetch protein names or labels for a list of UniProt identifiers by making sequential requests.
10
11
 
@@ -24,10 +25,10 @@ def search_uniprot_labels(identifiers: List[str]) -> Dict[str, str]:
24
25
  response.raise_for_status()
25
26
  data = response.json()
26
27
  protein_name = (
27
- data.get('proteinDescription', {})
28
- .get('recommendedName', {})
29
- .get('fullName', {})
30
- .get('value', 'Name not found')
28
+ data.get("proteinDescription", {})
29
+ .get("recommendedName", {})
30
+ .get("fullName", {})
31
+ .get("value", "Name not found")
31
32
  )
32
33
  results[identifier] = protein_name
33
34
  except requests.exceptions.RequestException as e:
@@ -1,6 +1,5 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
4
4
 
5
- from . import agents
6
- from . import tools
5
+ from . import agents, tools
@@ -1,5 +1,5 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
4
4
 
5
5
  from . import t2b_agent
@@ -1,3 +1,3 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
@@ -1,7 +1,7 @@
1
1
  _target_: agents.t2b_agent.get_app
2
2
  state_modifier: >
3
3
  You are Talk2BioModels agent.
4
- If the user asks for the uploaded model,
4
+ If the user asks for the uploaded model,
5
5
  then pass the use_uploaded_model argument
6
6
  as True. If the user asks for simulation
7
7
  or param_scan or steady state, suggest a
@@ -3,4 +3,4 @@ defaults:
3
3
  - agents/t2b_agent: default
4
4
  - tools/ask_question: default
5
5
  - tools/get_annotation: default
6
- - tools/custom_plotter: default
6
+ - tools/custom_plotter: default
@@ -1,6 +1,5 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
4
- from . import ask_question
5
- from . import get_annotation
6
- from . import custom_plotter
3
+ """
4
+
5
+ from . import ask_question, custom_plotter, get_annotation
@@ -1,3 +1,3 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
@@ -13,7 +13,7 @@ steady_state_prompt: >
13
13
  1. If the user wants to know the time taken by the model to reach
14
14
  steady state, you should look at the `steady_state_transition_time`
15
15
  column of the data for the model species.
16
-
16
+
17
17
  2. The highest value in the column `steady_state_transition_time`
18
18
  is the time taken by the model to reach steady state.
19
19
 
@@ -28,4 +28,3 @@ simulation_prompt: >
28
28
  each time point.
29
29
 
30
30
  3. Please use the units provided below to answer the questions.
31
-
@@ -1,3 +1,3 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
@@ -5,4 +5,4 @@ system_prompt_custom_header: >
5
5
  If the user asks for very specific species (for example, using the
6
6
  keyword `only` or `exactly` in the question), set this attribute to
7
7
  correspond strictly to the species available in the simulation results,
8
- otherwise set it to None.
8
+ otherwise set it to None.
@@ -1,3 +1,3 @@
1
- '''
1
+ """
2
2
  Import all the modules in the package
3
- '''
3
+ """
@@ -5,4 +5,4 @@ prompt: >
5
5
  If none of the species match the user question, return None.
6
6
  If the user asks for all species, return all species.
7
7
  If the user does not specify any species or simpley asks for
8
- model annotations, return all species.
8
+ model annotations, return all species.
@@ -0,0 +1,63 @@
1
+ # Talk2BioModels
2
+
3
+ ## Installation
4
+
5
+ ### Docker (stable-release)
6
+
7
+ _This agent is available on Docker Hub._
8
+
9
+ ### Run via `docker run`
10
+
11
+ ```sh
12
+ docker run -d \
13
+ --name talk2biomodels \
14
+ -e OPENAI_API_KEY=<your_openai_api_key> \
15
+ -e NVIDIA_API_KEY=<your_nvidia_api_key> \
16
+ -p 8501:8501 \
17
+ virtualpatientengine/talk2biomodels
18
+ ```
19
+
20
+ ### Access the Web UI
21
+
22
+ Once started, open:
23
+
24
+ ```
25
+ http://localhost:8501
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Environment Variables
31
+
32
+ - `OPENAI_API_KEY` – required
33
+ - `NVIDIA_API_KEY` – required
34
+
35
+ ---
36
+
37
+ ## Get Key
38
+
39
+ - `NVIDIA_API_KEY` – required (obtain a free key at [https://build.nvidia.com/explore/discover](https://build.nvidia.com/explore/discover))
40
+
41
+ **LangSmith** support is optional. To enable it, create an API key [here](https://docs.smith.langchain.com/administration/how_to_guides/organization_management/create_account_api_key).
42
+
43
+ _Please note that this will create a new tracing project in your Langsmith
44
+ account with the name `T2X-xxxx`, where `X` can be `B` (Biomodels).
45
+ If you skip the previous step, it will default to the name `default`.
46
+ `xxxx` will be the 4-digit ID created for the session._
47
+
48
+ ---
49
+
50
+ ## Running Multiple Agents
51
+
52
+ By default, this agent listens on port `8501`. To run another agent on a different port, map a different host port:
53
+
54
+ ```sh
55
+ docker run -d \
56
+ --name talk2biomodels \
57
+ -e OPENAI_API_KEY=<your_openai_api_key> \
58
+ -e NVIDIA_API_KEY=<your_nvidia_api_key> \
59
+ -p 8502:8501 \
60
+ virtualpatientengine/talk2biomodels
61
+ ```
62
+
63
+ Then visit: [http://localhost:8502](http://localhost:8502)
@@ -1,5 +1,5 @@
1
- '''
1
+ """
2
2
  This file is used to import all the models in the package.
3
- '''
4
- from . import basico_model
5
- from . import sys_bio_model
3
+ """
4
+
5
+ from . import basico_model, sys_bio_model
@@ -6,30 +6,34 @@ using the basico package.
6
6
  """
7
7
 
8
8
  import logging
9
- from typing import Optional, Dict, Union
10
- from pydantic import Field, model_validator
11
- import pandas as pd
9
+
12
10
  import basico
11
+ import pandas as pd
12
+ from pydantic import Field, model_validator
13
+
13
14
  from .sys_bio_model import SysBioModel
14
15
 
15
16
  # Initialize logger
16
17
  logging.basicConfig(level=logging.INFO)
17
18
  logger = logging.getLogger(__name__)
18
19
 
20
+
19
21
  class BasicoModel(SysBioModel):
20
22
  """
21
23
  Model that loads and simulates SBML models using the basico package.
22
24
  Can load models from an SBML file or download them using a BioModels biomodel_id.
23
25
  """
24
- biomodel_id: Optional[Union[int, str]] = Field(None,
25
- description="BioModels model ID to download and load")
26
- sbml_file_path: Optional[str] = Field(None, description="Path to an SBML file to load")
27
- simulation_results: Optional[str] = None
28
- name: Optional[str] = Field("", description="Name of the model")
29
- description: Optional[str] = Field("", description="Description of the model")
26
+
27
+ biomodel_id: int | str | None = Field(
28
+ None, description="BioModels model ID to download and load"
29
+ )
30
+ sbml_file_path: str | None = Field(None, description="Path to an SBML file to load")
31
+ simulation_results: str | None = None
32
+ name: str | None = Field("", description="Name of the model")
33
+ description: str | None = Field("", description="Description of the model")
30
34
 
31
35
  # Additional attribute not included in the schema
32
- copasi_model: Optional[object] = None # Holds the loaded Copasi model
36
+ copasi_model: object | None = None # Holds the loaded Copasi model
33
37
 
34
38
  @model_validator(mode="after")
35
39
  def check_biomodel_id_or_sbml_file_path(self):
@@ -49,7 +53,7 @@ class BasicoModel(SysBioModel):
49
53
  self.name = basico.model_info.get_model_name(model=self.copasi_model)
50
54
  return self
51
55
 
52
- def update_parameters(self, parameters: Dict[str, Union[float, int]]) -> None:
56
+ def update_parameters(self, parameters: dict[str, float | int]) -> None:
53
57
  """
54
58
  Update model parameters with new values.
55
59
  """
@@ -63,35 +67,39 @@ class BasicoModel(SysBioModel):
63
67
  df_all_species = basico.model_info.get_species(model=self.copasi_model)
64
68
  # if param is a kinetic parameter
65
69
  if param_name in df_all_params.index.tolist():
66
- basico.model_info.set_parameters(name=param_name,
67
- exact=True,
68
- initial_value=param_value,
69
- model=self.copasi_model)
70
+ basico.model_info.set_parameters(
71
+ name=param_name,
72
+ exact=True,
73
+ initial_value=param_value,
74
+ model=self.copasi_model,
75
+ )
70
76
  # if param is a species
71
77
  elif param_name in df_all_species.index.tolist():
72
- basico.model_info.set_species(name=param_name,
73
- exact=True,
74
- initial_concentration=param_value,
75
- model=self.copasi_model)
78
+ basico.model_info.set_species(
79
+ name=param_name,
80
+ exact=True,
81
+ initial_concentration=param_value,
82
+ model=self.copasi_model,
83
+ )
76
84
  else:
77
85
  logger.error("Parameter/Species %s not found in the model.", param_name)
78
86
  raise ValueError(f"Parameter/Species {param_name} not found in the model.")
79
87
 
80
- def simulate(self, duration: Union[int, float] = 10, interval: int = 10) -> pd.DataFrame:
88
+ def simulate(self, duration: int | float = 10, interval: int = 10) -> pd.DataFrame:
81
89
  """
82
90
  Simulate the COPASI model over a specified range of time points.
83
-
91
+
84
92
  Args:
85
93
  duration: Duration of the simulation in time units.
86
94
  interval: Interval between time points in the simulation.
87
-
95
+
88
96
  Returns:
89
97
  Pandas DataFrame with time-course simulation results.
90
98
  """
91
99
  # Run the simulation and return results
92
- df_result = basico.run_time_course(model=self.copasi_model,
93
- intervals=interval,
94
- duration=duration)
100
+ df_result = basico.run_time_course(
101
+ model=self.copasi_model, intervals=interval, duration=duration
102
+ )
95
103
  # # Replace curly braces in column headers with square brackets
96
104
  # # Because curly braces in the world of LLMS are used for
97
105
  # # structured output
@@ -104,14 +112,14 @@ class BasicoModel(SysBioModel):
104
112
  # Return copy of the simulation results
105
113
  return df_result.copy()
106
114
 
107
- def get_model_metadata(self) -> Dict[str, Union[str, int]]:
115
+ def get_model_metadata(self) -> dict[str, str | int]:
108
116
  """
109
117
  Retrieve metadata specific to the COPASI model.
110
-
118
+
111
119
  Returns:
112
120
  Dictionary of model metadata.
113
121
  """
114
122
  return {
115
123
  "Model Type": "SBML Model (COPASI)",
116
- "Parameter Count": len(basico.get_parameters())
124
+ "Parameter Count": len(basico.get_parameters()),
117
125
  }
@@ -1,21 +1,23 @@
1
- '''
1
+ """
2
2
  An abstract base class for BioModels in the BioModels repository.
3
- '''
3
+ """
4
4
 
5
5
  from abc import ABC, abstractmethod
6
- from typing import List, Dict, Union, Optional
6
+
7
7
  from pydantic import BaseModel, Field, model_validator
8
8
 
9
+
9
10
  class SysBioModel(ABC, BaseModel):
10
11
  """
11
12
  Abstract base class for BioModels in the BioModels repository.
12
13
  This class serves as a general structure for models, allowing
13
14
  different mathematical approaches to be implemented in subclasses.
14
15
  """
15
- biomodel_id: Optional[int] = Field(None, description="BioModel ID of the model")
16
- sbml_file_path: Optional[str] = Field(None, description="Path to an SBML file")
17
- name: Optional[str] = Field(..., description="Name of the model")
18
- description: Optional[str] = Field("", description="Description of the model")
16
+
17
+ biomodel_id: int | None = Field(None, description="BioModel ID of the model")
18
+ sbml_file_path: str | None = Field(None, description="Path to an SBML file")
19
+ name: str | None = Field(..., description="Name of the model")
20
+ description: str | None = Field("", description="Description of the model")
19
21
 
20
22
  @model_validator(mode="after")
21
23
  def check_biomodel_id_or_sbml_file_path(self):
@@ -27,7 +29,7 @@ class SysBioModel(ABC, BaseModel):
27
29
  return self
28
30
 
29
31
  @abstractmethod
30
- def get_model_metadata(self) -> Dict[str, Union[str, int]]:
32
+ def get_model_metadata(self) -> dict[str, str | int]:
31
33
  """
32
34
  Abstract method to retrieve metadata of the model.
33
35
  This method should return a dictionary containing model metadata.
@@ -35,8 +37,9 @@ class SysBioModel(ABC, BaseModel):
35
37
  Returns:
36
38
  dict: Dictionary with model metadata
37
39
  """
40
+
38
41
  @abstractmethod
39
- def update_parameters(self, parameters: Dict[str, Union[float, int]]) -> None:
42
+ def update_parameters(self, parameters: dict[str, float | int]) -> None:
40
43
  """
41
44
  Abstract method to update model parameters.
42
45
 
@@ -45,7 +48,7 @@ class SysBioModel(ABC, BaseModel):
45
48
  """
46
49
 
47
50
  @abstractmethod
48
- def simulate(self, duration: Union[int, float]) -> List[float]:
51
+ def simulate(self, duration: int | float) -> list[float]:
49
52
  """
50
53
  Abstract method to run a simulation of the model.
51
54
 
@@ -1,5 +1,6 @@
1
- '''
1
+ """
2
2
  This file is used to import all the modules in the package.
3
- '''
3
+ """
4
+
4
5
  # import everything from the module
5
6
  from . import state_talk2biomodels
@@ -1,33 +1,37 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- '''
3
+ """
4
4
  This is the state file for the Talk2BioModels agent.
5
- '''
5
+ """
6
6
 
7
- from typing import Annotated
8
7
  import operator
9
- from langgraph.prebuilt.chat_agent_executor import AgentState
10
- from langchain_core.language_models import BaseChatModel
8
+ from typing import Annotated
9
+
11
10
  from langchain_core.embeddings import Embeddings
11
+ from langchain_core.language_models import BaseChatModel
12
+ from langgraph.prebuilt.chat_agent_executor import AgentState
13
+
12
14
 
13
15
  def add_data(data1: dict, data2: dict) -> dict:
14
16
  """
15
17
  A reducer function to merge two dictionaries.
16
18
  """
17
- left_idx_by_name = {data['name']: idx for idx, data in enumerate(data1)}
19
+ left_idx_by_name = {data["name"]: idx for idx, data in enumerate(data1)}
18
20
  merged = data1.copy()
19
21
  for data in data2:
20
- idx = left_idx_by_name.get(data['name'])
22
+ idx = left_idx_by_name.get(data["name"])
21
23
  if idx is not None:
22
24
  merged[idx] = data
23
25
  else:
24
26
  merged.append(data)
25
27
  return merged
26
28
 
29
+
27
30
  class Talk2Biomodels(AgentState):
28
31
  """
29
32
  The state for the Talk2BioModels agent.
30
33
  """
34
+
31
35
  llm_model: BaseChatModel
32
36
  text_embedding_model: Embeddings
33
37
  pdf_file_name: str
@@ -41,4 +45,4 @@ class Talk2Biomodels(AgentState):
41
45
  dic_simulated_data: Annotated[list[dict], add_data]
42
46
  dic_scanned_data: Annotated[list[dict], add_data]
43
47
  dic_steady_state_data: Annotated[list[dict], add_data]
44
- dic_annotations_data : Annotated[list[dict], add_data]
48
+ dic_annotations_data: Annotated[list[dict], add_data]