aiagents4pharma 1.4.2__tar.gz → 1.4.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 (24) hide show
  1. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/PKG-INFO +3 -3
  2. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/README.md +1 -1
  3. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/models/basico_model.py +13 -1
  4. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/fetch_parameters.py +26 -2
  5. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/search_models.py +13 -1
  6. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma.egg-info/PKG-INFO +3 -3
  7. aiagents4pharma-1.4.3/release_version.txt +1 -0
  8. aiagents4pharma-1.4.2/release_version.txt +0 -1
  9. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/LICENSE +0 -0
  10. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/__init__.py +0 -0
  11. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/__init__.py +0 -0
  12. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/models/__init__.py +0 -0
  13. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/models/sys_bio_model.py +0 -0
  14. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/__init__.py +0 -0
  15. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/ask_question.py +0 -0
  16. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/custom_plotter.py +0 -0
  17. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/model_description.py +0 -0
  18. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma/talk2biomodels/tools/simulate_model.py +0 -0
  19. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma.egg-info/SOURCES.txt +0 -0
  20. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma.egg-info/dependency_links.txt +0 -0
  21. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma.egg-info/requires.txt +0 -0
  22. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/aiagents4pharma.egg-info/top_level.txt +0 -0
  23. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.3}/pyproject.toml +0 -0
  24. {aiagents4pharma-1.4.2 → aiagents4pharma-1.4.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.4.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
@@ -90,7 +90,7 @@ Check out the tutorials on each agent for detailed instrcutions.
90
90
 
91
91
  2. **Install dependencies:**
92
92
  ```bash
93
- pip install -r requirements.txt
93
+ pip install .
94
94
  ```
95
95
 
96
96
  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**
@@ -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'''
@@ -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.4.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
@@ -90,7 +90,7 @@ Check out the tutorials on each agent for detailed instrcutions.
90
90
 
91
91
  2. **Install dependencies:**
92
92
  ```bash
93
- pip install -r requirements.txt
93
+ pip install .
94
94
  ```
95
95
 
96
96
  3. **Initialize OPENAI_API_KEY**
@@ -0,0 +1 @@
1
+ v1.4.3
@@ -1 +0,0 @@
1
- v1.4.2
File without changes