aiagents4pharma 1.4.2__tar.gz → 1.5.3__tar.gz

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 (31) hide show
  1. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/PKG-INFO +8 -4
  2. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/README.md +1 -1
  3. aiagents4pharma-1.5.3/aiagents4pharma/__init__.py +7 -0
  4. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/models/basico_model.py +13 -1
  5. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/fetch_parameters.py +26 -2
  6. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/search_models.py +13 -1
  7. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/__init__.py +4 -0
  8. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/datasets/__init__.py +7 -0
  9. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/datasets/biobridge_primekg.py +562 -0
  10. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/datasets/dataset.py +23 -0
  11. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/datasets/primekg.py +201 -0
  12. aiagents4pharma-1.5.3/aiagents4pharma/talk2knowledgegraphs/datasets/starkqa_primekg.py +201 -0
  13. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma.egg-info/PKG-INFO +8 -4
  14. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma.egg-info/SOURCES.txt +7 -1
  15. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma.egg-info/requires.txt +5 -1
  16. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/pyproject.toml +8 -2
  17. aiagents4pharma-1.5.3/release_version.txt +1 -0
  18. aiagents4pharma-1.4.2/aiagents4pharma/__init__.py +0 -5
  19. aiagents4pharma-1.4.2/release_version.txt +0 -1
  20. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/LICENSE +0 -0
  21. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/__init__.py +0 -0
  22. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/models/__init__.py +0 -0
  23. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/models/sys_bio_model.py +0 -0
  24. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/__init__.py +0 -0
  25. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/ask_question.py +0 -0
  26. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/custom_plotter.py +0 -0
  27. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/model_description.py +0 -0
  28. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma/talk2biomodels/tools/simulate_model.py +0 -0
  29. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma.egg-info/dependency_links.txt +0 -0
  30. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/aiagents4pharma.egg-info/top_level.txt +0 -0
  31. {aiagents4pharma-1.4.2 → aiagents4pharma-1.5.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: aiagents4pharma
3
- Version: 1.4.2
3
+ Version: 1.5.3
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
@@ -10,13 +10,16 @@ Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Requires-Dist: copasi_basico==0.78
12
12
  Requires-Dist: coverage==7.6.4
13
+ Requires-Dist: gdown==5.2.0
14
+ Requires-Dist: huggingface_hub==0.26.5
15
+ Requires-Dist: joblib==1.4.2
13
16
  Requires-Dist: langchain==0.3.7
14
17
  Requires-Dist: langchain-community==0.3.5
15
18
  Requires-Dist: langchain-core==0.3.15
16
19
  Requires-Dist: langchain-experimental==0.3.3
17
20
  Requires-Dist: langchain-openai==0.2.5
18
21
  Requires-Dist: matplotlib==3.9.2
19
- Requires-Dist: openai==1.55.3
22
+ Requires-Dist: openai==1.59.4
20
23
  Requires-Dist: pandas==2.2.3
21
24
  Requires-Dist: plotly==5.24.1
22
25
  Requires-Dist: pydantic==2.9.2
@@ -24,6 +27,7 @@ Requires-Dist: pylint==3.3.1
24
27
  Requires-Dist: pytest==8.3.3
25
28
  Requires-Dist: streamlit==1.39.0
26
29
  Requires-Dist: tabulate==0.9.0
30
+ Requires-Dist: torch==2.5.1
27
31
  Requires-Dist: tqdm==4.66.6
28
32
  Requires-Dist: mkdocs==1.6.1
29
33
  Requires-Dist: mkdocs-jupyter==0.25.1
@@ -90,7 +94,7 @@ Check out the tutorials on each agent for detailed instrcutions.
90
94
 
91
95
  2. **Install dependencies:**
92
96
  ```bash
93
- pip install -r requirements.txt
97
+ pip install .
94
98
  ```
95
99
 
96
100
  3. **Initialize OPENAI_API_KEY**
@@ -55,7 +55,7 @@ Check out the tutorials on each agent for detailed instrcutions.
55
55
 
56
56
  2. **Install dependencies:**
57
57
  ```bash
58
- pip install -r requirements.txt
58
+ pip install .
59
59
  ```
60
60
 
61
61
  3. **Initialize OPENAI_API_KEY**
@@ -0,0 +1,7 @@
1
+ '''
2
+ This file is used to import aiagents4pharma modules.
3
+ '''
4
+
5
+ from . import talk2biomodels
6
+ from . import talk2cells
7
+ from . import talk2knowledgegraphs
@@ -6,6 +6,8 @@ using the basico package.
6
6
  """
7
7
 
8
8
  from typing import Optional, Dict, Union
9
+ from time import sleep
10
+ from urllib.error import URLError
9
11
  from pydantic import Field, model_validator
10
12
  import pandas as pd
11
13
  import basico
@@ -33,7 +35,17 @@ class BasicoModel(SysBioModel):
33
35
  if not self.model_id and not self.sbml_file_path:
34
36
  raise ValueError("Either model_id or sbml_file_path must be provided.")
35
37
  if self.model_id:
36
- self.copasi_model = basico.load_biomodel(self.model_id)
38
+ attempts = 0
39
+ max_retries = 5
40
+ while attempts < max_retries:
41
+ try:
42
+ self.copasi_model = basico.load_biomodel(self.model_id)
43
+ break
44
+ except URLError as e:
45
+ attempts += 1
46
+ sleep(10*attempts)
47
+ if attempts >= max_retries:
48
+ raise e
37
49
  self.description = basico.biomodels.get_model_info(self.model_id)["description"]
38
50
  elif self.sbml_file_path:
39
51
  self.copasi_model = basico.load_model(self.sbml_file_path)
@@ -4,6 +4,8 @@
4
4
  Tool for fetching species and parameters from the model.
5
5
  """
6
6
 
7
+ from urllib.error import URLError
8
+ from time import sleep
7
9
  from typing import Type
8
10
  import basico
9
11
  from pydantic import BaseModel, Field
@@ -47,14 +49,36 @@ class FetchParametersTool(BaseTool):
47
49
  # Extract species from the model
48
50
  species = []
49
51
  if fetch_species:
50
- df_species = basico.model_info.get_species(model=model_obj.copasi_model)
52
+ df_species = self.get_species_and_parameters(model_obj, fetch_species=True)
51
53
  species = df_species.index.tolist()
52
54
  species = ','.join(species)
53
55
 
54
56
  # Extract parameters from the model
55
57
  parameters = []
56
58
  if fetch_parameters:
57
- df_parameters = basico.model_info.get_parameters(model=model_obj.copasi_model)
59
+ df_parameters = self.get_species_and_parameters(model_obj, fetch_species=False)
58
60
  parameters = df_parameters.index.tolist()
59
61
  parameters = ','.join(parameters)
60
62
  return {'Species': species, 'Parameters': parameters}
63
+
64
+ def get_species_and_parameters(self,
65
+ model_obj,
66
+ fetch_species: bool):
67
+ """
68
+ Get the species from the model.
69
+ """
70
+ attempts = 0
71
+ max_retries = 3
72
+ while attempts < max_retries:
73
+ try:
74
+ if fetch_species:
75
+ df = basico.model_info.get_species(model=model_obj.copasi_model)
76
+ else:
77
+ df = basico.model_info.get_parameters(model=model_obj.copasi_model)
78
+ break
79
+ except URLError as e:
80
+ attempts += 1
81
+ sleep(10)
82
+ if attempts >= max_retries:
83
+ raise e
84
+ return df
@@ -4,6 +4,8 @@
4
4
  Tool for searching models based on search query.
5
5
  """
6
6
 
7
+ from urllib.error import URLError
8
+ from time import sleep
7
9
  from typing import Type
8
10
  from pydantic import BaseModel, Field
9
11
  from basico import biomodels
@@ -39,7 +41,17 @@ class SearchModelsTool(BaseTool):
39
41
  Returns:
40
42
  str: The answer to the question.
41
43
  """
42
- search_results = biomodels.search_for_model(query)
44
+ attempts = 0
45
+ max_retries = 3
46
+ while attempts < max_retries:
47
+ try:
48
+ search_results = biomodels.search_for_model(query)
49
+ break
50
+ except URLError as e:
51
+ attempts += 1
52
+ sleep(10)
53
+ if attempts >= max_retries:
54
+ raise e
43
55
  llm = ChatOpenAI(model="gpt-4o-mini")
44
56
  # Check if run_manager's metadata has the key 'prompt_content'
45
57
  prompt_content = f'''
@@ -0,0 +1,4 @@
1
+ '''
2
+ This file is used to import the datasets, utils, and tools.
3
+ '''
4
+ from . import datasets
@@ -0,0 +1,7 @@
1
+ '''
2
+ This file is used to import all the models in the package.
3
+ '''
4
+ from . import dataset
5
+ from . import primekg
6
+ from . import starkqa_primekg
7
+ from . import biobridge_primekg