aiagents4pharma 1.9.0__py3-none-any.whl → 1.15.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 (66) hide show
  1. aiagents4pharma/__init__.py +9 -6
  2. aiagents4pharma/configs/config.yaml +2 -1
  3. aiagents4pharma/configs/talk2biomodels/__init__.py +1 -0
  4. aiagents4pharma/configs/talk2biomodels/agents/t2b_agent/default.yaml +9 -3
  5. aiagents4pharma/configs/talk2biomodels/tools/__init__.py +4 -0
  6. aiagents4pharma/configs/talk2biomodels/tools/ask_question/__init__.py +3 -0
  7. aiagents4pharma/talk2biomodels/__init__.py +1 -0
  8. aiagents4pharma/talk2biomodels/agents/t2b_agent.py +14 -11
  9. aiagents4pharma/talk2biomodels/api/__init__.py +6 -0
  10. aiagents4pharma/talk2biomodels/api/kegg.py +83 -0
  11. aiagents4pharma/talk2biomodels/api/ols.py +72 -0
  12. aiagents4pharma/talk2biomodels/api/uniprot.py +35 -0
  13. aiagents4pharma/talk2biomodels/models/basico_model.py +29 -32
  14. aiagents4pharma/talk2biomodels/models/sys_bio_model.py +9 -6
  15. aiagents4pharma/talk2biomodels/states/state_talk2biomodels.py +24 -7
  16. aiagents4pharma/talk2biomodels/tests/test_api.py +57 -0
  17. aiagents4pharma/talk2biomodels/tests/test_ask_question.py +44 -0
  18. aiagents4pharma/talk2biomodels/tests/test_basico_model.py +7 -8
  19. aiagents4pharma/talk2biomodels/tests/test_get_annotation.py +171 -0
  20. aiagents4pharma/talk2biomodels/tests/test_getmodelinfo.py +26 -0
  21. aiagents4pharma/talk2biomodels/tests/test_integration.py +126 -0
  22. aiagents4pharma/talk2biomodels/tests/test_param_scan.py +68 -0
  23. aiagents4pharma/talk2biomodels/tests/test_query_article.py +76 -0
  24. aiagents4pharma/talk2biomodels/tests/test_search_models.py +28 -0
  25. aiagents4pharma/talk2biomodels/tests/test_simulate_model.py +39 -0
  26. aiagents4pharma/talk2biomodels/tests/test_steady_state.py +90 -0
  27. aiagents4pharma/talk2biomodels/tests/test_sys_bio_model.py +13 -7
  28. aiagents4pharma/talk2biomodels/tools/__init__.py +4 -0
  29. aiagents4pharma/talk2biomodels/tools/ask_question.py +59 -25
  30. aiagents4pharma/talk2biomodels/tools/get_annotation.py +304 -0
  31. aiagents4pharma/talk2biomodels/tools/get_modelinfo.py +5 -3
  32. aiagents4pharma/talk2biomodels/tools/load_arguments.py +114 -0
  33. aiagents4pharma/talk2biomodels/tools/parameter_scan.py +287 -0
  34. aiagents4pharma/talk2biomodels/tools/query_article.py +59 -0
  35. aiagents4pharma/talk2biomodels/tools/simulate_model.py +20 -89
  36. aiagents4pharma/talk2biomodels/tools/steady_state.py +167 -0
  37. aiagents4pharma/talk2competitors/__init__.py +5 -0
  38. aiagents4pharma/talk2competitors/agents/__init__.py +6 -0
  39. aiagents4pharma/talk2competitors/agents/main_agent.py +130 -0
  40. aiagents4pharma/talk2competitors/agents/s2_agent.py +75 -0
  41. aiagents4pharma/talk2competitors/config/__init__.py +5 -0
  42. aiagents4pharma/talk2competitors/config/config.py +110 -0
  43. aiagents4pharma/talk2competitors/state/__init__.py +5 -0
  44. aiagents4pharma/talk2competitors/state/state_talk2competitors.py +32 -0
  45. aiagents4pharma/talk2competitors/tests/__init__.py +3 -0
  46. aiagents4pharma/talk2competitors/tests/test_langgraph.py +274 -0
  47. aiagents4pharma/talk2competitors/tools/__init__.py +7 -0
  48. aiagents4pharma/talk2competitors/tools/s2/__init__.py +8 -0
  49. aiagents4pharma/talk2competitors/tools/s2/display_results.py +25 -0
  50. aiagents4pharma/talk2competitors/tools/s2/multi_paper_rec.py +132 -0
  51. aiagents4pharma/talk2competitors/tools/s2/search.py +119 -0
  52. aiagents4pharma/talk2competitors/tools/s2/single_paper_rec.py +141 -0
  53. aiagents4pharma/talk2knowledgegraphs/__init__.py +2 -1
  54. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_enrichments.py +39 -0
  55. aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_ollama.py +117 -0
  56. aiagents4pharma/talk2knowledgegraphs/utils/__init__.py +5 -0
  57. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/__init__.py +5 -0
  58. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/enrichments.py +36 -0
  59. aiagents4pharma/talk2knowledgegraphs/utils/enrichments/ollama.py +123 -0
  60. {aiagents4pharma-1.9.0.dist-info → aiagents4pharma-1.15.0.dist-info}/METADATA +42 -23
  61. aiagents4pharma-1.15.0.dist-info/RECORD +102 -0
  62. aiagents4pharma/talk2biomodels/tests/test_langgraph.py +0 -240
  63. aiagents4pharma-1.9.0.dist-info/RECORD +0 -62
  64. {aiagents4pharma-1.9.0.dist-info → aiagents4pharma-1.15.0.dist-info}/LICENSE +0 -0
  65. {aiagents4pharma-1.9.0.dist-info → aiagents4pharma-1.15.0.dist-info}/WHEEL +0 -0
  66. {aiagents4pharma-1.9.0.dist-info → aiagents4pharma-1.15.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """
4
+ Enrichment class using Ollama model based on LangChain Enrichment class.
5
+ """
6
+
7
+ import time
8
+ from typing import List
9
+ import subprocess
10
+ import ast
11
+ import ollama
12
+ from langchain_ollama import ChatOllama
13
+ from langchain_core.prompts import ChatPromptTemplate
14
+ from langchain_core.output_parsers import StrOutputParser
15
+ from .enrichments import Enrichments
16
+
17
+ class EnrichmentWithOllama(Enrichments):
18
+ """
19
+ Enrichment class using Ollama model based on the Enrichment abstract class.
20
+ """
21
+ def __init__(
22
+ self,
23
+ model_name: str,
24
+ prompt_enrichment: str,
25
+ temperature: float,
26
+ streaming: bool,
27
+ ):
28
+ """
29
+ Initialize the EnrichmentWithOllama class.
30
+
31
+ Args:
32
+ model_name: The name of the Ollama model to be used.
33
+ prompt_enrichment: The prompt enrichment template.
34
+ temperature: The temperature for the Ollama model.
35
+ streaming: The streaming flag for the Ollama model.
36
+ """
37
+ # Setup the Ollama server
38
+ self.__setup(model_name)
39
+
40
+ # Set parameters
41
+ self.model_name = model_name
42
+ self.prompt_enrichment = prompt_enrichment
43
+ self.temperature = temperature
44
+ self.streaming = streaming
45
+
46
+ # Prepare prompt template
47
+ self.prompt_template = ChatPromptTemplate.from_messages(
48
+ [
49
+ ("system", self.prompt_enrichment),
50
+ ("human", "{input}"),
51
+ ]
52
+ )
53
+
54
+ # Prepare model
55
+ self.model = ChatOllama(
56
+ model=self.model_name,
57
+ temperature=self.temperature,
58
+ streaming=self.streaming,
59
+ )
60
+
61
+ def __setup(self, model_name: str) -> None:
62
+ """
63
+ Check if the Ollama model is available and run the Ollama server if needed.
64
+
65
+ Args:
66
+ model_name: The name of the Ollama model to be used.
67
+ """
68
+ try:
69
+ models_list = ollama.list()["models"]
70
+ if model_name not in [m['model'].replace(":latest", "") for m in models_list]:
71
+ ollama.pull(model_name)
72
+ time.sleep(30)
73
+ raise ValueError(f"Pulled {model_name} model")
74
+ except Exception as e:
75
+ with subprocess.Popen(
76
+ "ollama serve", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
77
+ ):
78
+ time.sleep(10)
79
+ raise ValueError(f"Error: {e} and restarted Ollama server.") from e
80
+
81
+ def enrich_documents(self, texts: List[str]) -> List[str]:
82
+ """
83
+ Enrich a list of input texts with additional textual features using OLLAMA model.
84
+ Important: Make sure the input is a list of texts based on the defined prompt template
85
+ with 'input' as the variable name.
86
+
87
+ Args:
88
+ texts: The list of texts to be enriched.
89
+
90
+ Returns:
91
+ The list of enriched texts.
92
+ """
93
+
94
+ # Perform enrichment
95
+ chain = self.prompt_template | self.model | StrOutputParser()
96
+
97
+ # Generate the enriched node
98
+ # Important: Make sure the input is a list of texts based on the defined prompt template
99
+ # with 'input' as the variable name
100
+ enriched_texts = chain.invoke({"input": "[" + ", ".join(texts) + "]"})
101
+
102
+ # Convert the enriched nodes to a list of dictionary
103
+ enriched_texts = ast.literal_eval(enriched_texts.replace("```", ""))
104
+
105
+ # Final check for the enriched texts
106
+ assert len(enriched_texts) == len(texts)
107
+
108
+ return enriched_texts
109
+
110
+ def enrich_documents_with_rag(self, texts, docs):
111
+ """
112
+ Enrich a list of input texts with additional textual features using OLLAMA model with RAG.
113
+ As of now, we don't have a RAG model to test this method yet.
114
+ Thus, we will just call the enrich_documents method instead.
115
+
116
+ Args:
117
+ texts: The list of texts to be enriched.
118
+ docs: The list of reference documents to enrich the input texts.
119
+
120
+ Returns:
121
+ The list of enriched texts
122
+ """
123
+ return self.enrich_documents(texts)
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: aiagents4pharma
3
- Version: 1.9.0
3
+ Version: 1.15.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
7
7
  Classifier: Operating System :: OS Independent
8
- Requires-Python: >=3.10
8
+ Requires-Python: >=3.12
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Requires-Dist: copasi_basico==0.78
@@ -20,13 +20,16 @@ Requires-Dist: langchain-community==0.3.5
20
20
  Requires-Dist: langchain-core==0.3.31
21
21
  Requires-Dist: langchain-experimental==0.3.3
22
22
  Requires-Dist: langchain-openai==0.2.5
23
+ Requires-Dist: langchain_ollama==0.2.2
23
24
  Requires-Dist: langgraph==0.2.66
24
25
  Requires-Dist: matplotlib==3.9.2
25
26
  Requires-Dist: openai==1.59.4
27
+ Requires-Dist: ollama==0.4.6
26
28
  Requires-Dist: pandas==2.2.3
27
29
  Requires-Dist: plotly==5.24.1
28
30
  Requires-Dist: pydantic==2.9.2
29
31
  Requires-Dist: pylint==3.3.1
32
+ Requires-Dist: pypdf==5.2.0
30
33
  Requires-Dist: pytest==8.3.3
31
34
  Requires-Dist: pytest-asyncio==0.25.2
32
35
  Requires-Dist: streamlit==1.39.0
@@ -48,6 +51,9 @@ Requires-Dist: streamlit-feedback
48
51
  [![Talk2Cells](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2cells.yml/badge.svg)](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2cells.yml)
49
52
  [![Talk2KnowledgeGraphs](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2knowledgegraphs.yml/badge.svg)](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2knowledgegraphs.yml)
50
53
  [![Talk2Competitors](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2competitors.yml/badge.svg)](https://github.com/VirtualPatientEngine/AIAgents4Pharma/actions/workflows/tests_talk2competitors.yml)
54
+ ![GitHub Release](https://img.shields.io/github/v/release/VirtualPatientEngine/AIAgents4Pharma)
55
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FVirtualPatientEngine%2FAIAgents4Pharma%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
56
+
51
57
 
52
58
  <h1 align="center" style="border-bottom: none;">🤖 AIAgents4Pharma</h1>
53
59
 
@@ -56,9 +62,9 @@ Welcome to **AIAgents4Pharma** – an open-source project by [Team VPE](https://
56
62
  Our toolkit currently consists of three intelligent agents, each designed to simplify and enhance access to specialized data in biology:
57
63
 
58
64
  - **Talk2BioModels**: Engage directly with mathematical models in systems biology.
59
- - **Talk2Cells** *(Work in progress)*: Query and analyze sequencing data with ease.
60
- - **Talk2KnowledgeGraphs** *(Work in progress)*: Access and explore complex biological knowledge graphs for insightful data connections.
61
- - **Talk2Competitors** *(Coming soon)*: Get recommendations for articles related to your choice. Download, query, and write/retrieve them to your reference manager (currently supporting Zotero).
65
+ - **Talk2Cells** _(Work in progress)_: Query and analyze sequencing data with ease.
66
+ - **Talk2KnowledgeGraphs** _(Work in progress)_: Access and explore complex biological knowledge graphs for insightful data connections.
67
+ - **Talk2Competitors** _(Coming soon)_: Get recommendations for articles related to your choice. Download, query, and write/retrieve them to your reference manager (currently supporting Zotero).
62
68
 
63
69
  ---
64
70
 
@@ -71,68 +77,77 @@ Our toolkit currently consists of three intelligent agents, each designed to sim
71
77
  - Forward simulation of both internal and open-source models (BioModels).
72
78
  - Adjust parameters within the model to simulate different conditions.
73
79
  - Query simulation results.
80
+ - Extract model information such as species, parameters, units and description.
74
81
 
75
- ### 2. Talk2Cells *(Work in Progress)*
82
+ ### 2. Talk2Cells _(Work in Progress)_
76
83
 
77
84
  **Talk2Cells** is being developed to provide direct access to and analysis of sequencing data, such as RNA-Seq or DNA-Seq, using natural language.
78
85
 
79
- ### 3. Talk2KnowledgeGraphs *(Work in Progress)*
86
+ ### 3. Talk2KnowledgeGraphs _(Work in Progress)_
80
87
 
81
88
  **Talk2KnowledgeGraphs** is an agent designed to enable interaction with biological knowledge graphs (KGs). KGs integrate vast amounts of structured biological data into a format that highlights relationships between entities, such as proteins, genes, and diseases.
82
89
 
83
- ### 4. Talk2KnowledgeGraphs *(Coming soon)*
90
+ ### 4. Talk2Competitors _(Coming soon)_
84
91
 
85
92
  ## Getting Started
86
93
 
87
- ### Prerequisites
88
-
89
- - **Python 3.10+**
90
- - **Git**
91
- - Required libraries specified in `requirements.txt`
94
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FVirtualPatientEngine%2FAIAgents4Pharma%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
92
95
 
93
96
  ### Installation
97
+
94
98
  #### Option 1: PyPI
95
- ```bash
96
- pip install aiagents4pharma
97
- ```
99
+
100
+ ```bash
101
+ pip install aiagents4pharma
102
+ ```
98
103
 
99
104
  Check out the tutorials on each agent for detailed instrcutions.
100
105
 
101
106
  #### Option 2: git
107
+
102
108
  1. **Clone the repository:**
109
+
103
110
  ```bash
104
111
  git clone https://github.com/VirtualPatientEngine/AIAgents4Pharma
105
112
  cd AIAgents4Pharma
106
113
  ```
107
114
 
108
115
  2. **Install dependencies:**
116
+
109
117
  ```bash
110
118
  pip install .
111
119
  ```
112
120
 
113
121
  3. **Initialize OPENAI_API_KEY**
122
+
114
123
  ```bash
115
- export OPENAI_API_KEY = ....
124
+ export OPENAI_API_KEY=....
116
125
  ```
117
126
 
118
127
  4. **[Optional] Set up login credentials**
128
+
119
129
  ```bash
120
130
  vi .streamlit/secrets.toml
121
131
  ```
132
+
122
133
  and enter
134
+
123
135
  ```
124
136
  password='XXX'
125
137
  ```
126
- Please note that the passowrd will be same for all the users.
138
+
139
+ Please note that the passoword will be same for all the users.
127
140
 
128
141
  5. **[Optional] Initialize LANGSMITH_API_KEY**
142
+
129
143
  ```bash
130
144
  export LANGCHAIN_TRACING_V2=true
131
145
  export LANGCHAIN_API_KEY=<your-api-key>
132
146
  ```
133
- Please note that this will create a new tracing project in your Langsmith
134
- account with the name `<user_name>@<uuid>`, where `user_name` is the name
135
- you provided in the previous step. If you skip the previous step, it will
147
+
148
+ Please note that this will create a new tracing project in your Langsmith
149
+ account with the name `<user_name>@<uuid>`, where `user_name` is the name
150
+ you provided in the previous step. If you skip the previous step, it will
136
151
  default to `default`. <uuid> will be the 128 bit unique ID created for the
137
152
  session.
138
153
 
@@ -164,6 +179,7 @@ We welcome contributions to AIAgents4Pharma! Here’s how you can help:
164
179
  5. **Open a pull request**
165
180
 
166
181
  ### Current Needs
182
+
167
183
  - **Beta testers** for Talk2BioModels.
168
184
  - **Developers** with experience in natural language processing, bioinformatics, or knowledge graphs for contributions to AIAgents4Pharma.
169
185
 
@@ -174,19 +190,22 @@ Check out our [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
174
190
  ## Roadmap
175
191
 
176
192
  ### Completed
193
+
177
194
  - **Talk2BioModels**: Initial release with core capabilities for interacting with systems biology models.
178
195
 
179
196
  ### Planned
197
+
180
198
  - **User Interface**: Interactive web UI for all agents.
181
199
  - **Talk2Cells**: Integration of sequencing data analysis tools.
182
200
  - **Talk2KnowledgeGraphs**: Interface for biological knowledge graph interaction.
183
- - **Talk2Competitors**
201
+ - **Talk2Competitors**: Interface for exploring articles
184
202
 
185
- We’re excited to bring AIAgents4Pharma to the bioinformatics and pharmaceutical research community. Together, let’s make data-driven biological research more accessible and insightful.
203
+ We’re excited to bring AIAgents4Pharma to the bioinformatics and pharmaceutical research community. Together, let’s make data-driven biological research more accessible and insightful.
186
204
 
187
205
  **Get Started** with AIAgents4Pharma today and transform the way you interact with biological data.
188
206
 
189
207
  ---
190
208
 
191
209
  ## Feedback
210
+
192
211
  Questions/Bug reports/Feature requests/Comments/Suggestions? We welcome all. Please use the `Isssues` tab 😀
@@ -0,0 +1,102 @@
1
+ aiagents4pharma/__init__.py,sha256=5muWWIg89VHPybfxonO_5xOMJPasKNsGdQRhozDaEmk,177
2
+ aiagents4pharma/configs/__init__.py,sha256=hNkSrXw1Ix1HhkGn_aaidr2coBYySfM0Hm_pMeRcX7k,76
3
+ aiagents4pharma/configs/config.yaml,sha256=4t7obD0gOSfqnDDZZBB53ZC7zsmk7QDcM7T_1Hf1wIQ,112
4
+ aiagents4pharma/configs/talk2biomodels/__init__.py,sha256=safyFKhkd5Wlirl9dMZIHWDLTpY2oLw9wjIM7ZtLIHk,88
5
+ aiagents4pharma/configs/talk2biomodels/agents/__init__.py,sha256=_ZoG8snICK2bidWtc2KOGs738LWg9_r66V9mOMnEb-E,71
6
+ aiagents4pharma/configs/talk2biomodels/agents/t2b_agent/__init__.py,sha256=-fAORvyFmG2iSvFOFDixmt9OTQRR58y89uhhu2EgbA8,46
7
+ aiagents4pharma/configs/talk2biomodels/agents/t2b_agent/default.yaml,sha256=eLrJIezoPJ6_DvrSYsi3eALl03o0hJhntej3ESoeKKg,551
8
+ aiagents4pharma/configs/talk2biomodels/tools/__init__.py,sha256=WxK7h5n39l-NSMvjLZyxDqzwWlVA6mQ69gzsbJ17vEk,72
9
+ aiagents4pharma/configs/talk2biomodels/tools/ask_question/__init__.py,sha256=-fAORvyFmG2iSvFOFDixmt9OTQRR58y89uhhu2EgbA8,46
10
+ aiagents4pharma/talk2biomodels/__init__.py,sha256=2ICwVh1u07SZv31Jd2DKHobauOxWNWY29_Gqq3kOnNQ,159
11
+ aiagents4pharma/talk2biomodels/agents/__init__.py,sha256=sn5-fREjMdEvb-OUan3iOqrgYGjplNx3J8hYOaW0Po8,128
12
+ aiagents4pharma/talk2biomodels/agents/t2b_agent.py,sha256=5h4n7dF13KuT5f9vzfK7EQTu_b0a0hB7ScLFlTKaNko,3449
13
+ aiagents4pharma/talk2biomodels/api/__init__.py,sha256=_GmDQqDLYpsUPUeE1nBNlT5AI9oTXIcqgOfNfvmonqA,123
14
+ aiagents4pharma/talk2biomodels/api/kegg.py,sha256=QzYDAfJ16E7tbHGxP8ZNWRizMkMRS_HJuucueXEC1Gg,2943
15
+ aiagents4pharma/talk2biomodels/api/ols.py,sha256=qq0Qy-gJDxanQW-HfCChDsTQsY1M41ua8hMlTnfuzrA,2202
16
+ aiagents4pharma/talk2biomodels/api/uniprot.py,sha256=aPUAVBR7UYXDuuhDpKezAK2aTMzo-NxFYFq6C0W5u6U,1175
17
+ aiagents4pharma/talk2biomodels/models/__init__.py,sha256=5fTHHm3PVloYPNKXbgNlcPgv3-u28ZquxGydFYDfhJA,122
18
+ aiagents4pharma/talk2biomodels/models/basico_model.py,sha256=PH25FTOuUjsmw_UUxoRb-4kptOYpicEn4GqS0phS3nk,4807
19
+ aiagents4pharma/talk2biomodels/models/sys_bio_model.py,sha256=JeoiGQAvQABHnG0wKR2XBmmxqQdtgO6kxaLDUTUmr1s,2001
20
+ aiagents4pharma/talk2biomodels/states/__init__.py,sha256=YLg1-N0D9qyRRLRqwqfLCLAqZYDtMVZTfI8Y0b_4tbA,139
21
+ aiagents4pharma/talk2biomodels/states/state_talk2biomodels.py,sha256=d_tDh93ip36hlUpMh-KOkYfBZ2SQwZlaY8p-1ZWKPhY,1355
22
+ aiagents4pharma/talk2biomodels/tests/__init__.py,sha256=Jbw5tJxSrjGoaK5IX3pJWDCNzhrVQ10lkYq2oQ_KQD8,45
23
+ aiagents4pharma/talk2biomodels/tests/test_api.py,sha256=7Kz2r5F5tjmn3F0LoM33oP-21W633936YHiyf5toGg0,1716
24
+ aiagents4pharma/talk2biomodels/tests/test_ask_question.py,sha256=yRkKK9HLB1bGGWm_WwOckwaUmmRfRAD9z2NFFGLIGTY,1560
25
+ aiagents4pharma/talk2biomodels/tests/test_basico_model.py,sha256=y82fpTJMPHwtXxlle1cGQ_2Bewwpxi0aJSVrVAYLhN0,2060
26
+ aiagents4pharma/talk2biomodels/tests/test_get_annotation.py,sha256=mKOacH28OB6xpFPygAlhBUQS93gnI5j-jAfSGu6uQMI,7465
27
+ aiagents4pharma/talk2biomodels/tests/test_getmodelinfo.py,sha256=6kChSc_MCnzXlDao_R8pKdhIELlg3MZrUa7hg8piJ4E,883
28
+ aiagents4pharma/talk2biomodels/tests/test_integration.py,sha256=ZsBXWSFLIcdzrO8obLJx8Ib2f9AAW3BI7H9Eqjdc5to,5057
29
+ aiagents4pharma/talk2biomodels/tests/test_param_scan.py,sha256=vRbnn4uVWFbfZbU4gVCjHi5WDCUrErut8ElzAPE5y84,2648
30
+ aiagents4pharma/talk2biomodels/tests/test_query_article.py,sha256=HhFgU5HzCipecEYlfbpPxN-SCIPKep22gpXCutWXRb8,2820
31
+ aiagents4pharma/talk2biomodels/tests/test_search_models.py,sha256=8ODFubLxWYD3I3KQWuUnJ2GZRzMjFpXInFBLxKxG_ME,929
32
+ aiagents4pharma/talk2biomodels/tests/test_simulate_model.py,sha256=GjLE1DZpcKUAFSmoHD86vkfK0b5LJPM8a4WYyraazig,1487
33
+ aiagents4pharma/talk2biomodels/tests/test_steady_state.py,sha256=zt15KQoQku6jyzvpJXwINGTyhEnQl8wX81ueHlxnUCA,3467
34
+ aiagents4pharma/talk2biomodels/tests/test_sys_bio_model.py,sha256=HSmBBViMi0jYf4gWX21IbppAfDzG0nr_S3KtKS9fZVQ,2165
35
+ aiagents4pharma/talk2biomodels/tools/__init__.py,sha256=6H2HWv5Q4NZYEmw-Ti5KZnJlEqhaC2HXSDZa6kiSl-U,350
36
+ aiagents4pharma/talk2biomodels/tools/ask_question.py,sha256=hWXg7o0sTMDWH1ZnxtashTALvXpvNoaomfcniEhw-Bw,4684
37
+ aiagents4pharma/talk2biomodels/tools/custom_plotter.py,sha256=HWwKTX3o4dk0GcRVTO2hPrFSu98mtJ4TKC_hbHXOe1c,4018
38
+ aiagents4pharma/talk2biomodels/tools/get_annotation.py,sha256=jCGkidvafuk1YzAH9GFwaVUF35maXTjg6XqBg_zLk44,12475
39
+ aiagents4pharma/talk2biomodels/tools/get_modelinfo.py,sha256=qA-4FOI-O728Nmn7s8JJ8HKwxvA9MZbst7NkPKTAMV4,5391
40
+ aiagents4pharma/talk2biomodels/tools/load_arguments.py,sha256=bffNIlBDTCSFYiZprA73yi8Jbb8z3Oh2decVNh1UnZc,4162
41
+ aiagents4pharma/talk2biomodels/tools/load_biomodel.py,sha256=pyVzLQoMnuJYEwsjeOlqcUrbU1F1Z-pNlgkhFaoKpy0,689
42
+ aiagents4pharma/talk2biomodels/tools/parameter_scan.py,sha256=aNh94LgBgVXBIczuNkbSsOZ9j54YVEdZWmZbZr7Nk8k,12465
43
+ aiagents4pharma/talk2biomodels/tools/query_article.py,sha256=1tpYiE69MYcqiNcRaBgNiYzkkNmuTnlxLuBL_FnRuBU,2058
44
+ aiagents4pharma/talk2biomodels/tools/search_models.py,sha256=Iq2ddofOOfZYtAurCISq3bAq5rbwB3l_rL1lgEFyFCI,2653
45
+ aiagents4pharma/talk2biomodels/tools/simulate_model.py,sha256=qXs9lg9XgA7EaRiX3wBS8w_ug8tI-G3pzhcRg6dTRio,5060
46
+ aiagents4pharma/talk2biomodels/tools/steady_state.py,sha256=j3ckuNlUtv7lT922MbN0JhT9H0JpWAdx2mLPwao6uu8,7123
47
+ aiagents4pharma/talk2cells/__init__.py,sha256=zmOP5RAhabgKIQP-W4P4qKME2tG3fhAXM3MeO5_H8kE,120
48
+ aiagents4pharma/talk2cells/agents/__init__.py,sha256=38nK2a_lEFRjO3qD6Fo9a3983ZCYat6hmJKWY61y2Mo,128
49
+ aiagents4pharma/talk2cells/agents/scp_agent.py,sha256=gDMfhUNWHa_XWOqm1Ql6yLAdI_7bnIk5sRYn43H2sYk,3090
50
+ aiagents4pharma/talk2cells/states/__init__.py,sha256=e4s8pHZaR6UC42DtmsOzCVms5gxp5QEzLE4bG54YYko,135
51
+ aiagents4pharma/talk2cells/states/state_talk2cells.py,sha256=en5LikmabPZA6lLVpmYXff0Q3Fno0N2PBSMxk3gLWaE,253
52
+ aiagents4pharma/talk2cells/tests/scp_agent/test_scp_agent.py,sha256=f8bsUXvEElvYM5KGvpPzI1xOR5Y_zpm3_Jzk7gCX1CE,732
53
+ aiagents4pharma/talk2cells/tools/__init__.py,sha256=38nK2a_lEFRjO3qD6Fo9a3983ZCYat6hmJKWY61y2Mo,128
54
+ aiagents4pharma/talk2cells/tools/scp_agent/__init__.py,sha256=s7g0lyH1lMD9pcWHLPtwRJRvzmTh2II7DrxyLulpjmQ,163
55
+ aiagents4pharma/talk2cells/tools/scp_agent/display_studies.py,sha256=6q59gh_NQaiOU2rn55A3sIIFKlXi4SK3iKgySvUDrtQ,600
56
+ aiagents4pharma/talk2cells/tools/scp_agent/search_studies.py,sha256=MLe-twtFnOu-P8P9diYq7jvHBHbWFRRCZLcfpUzqPMg,2806
57
+ aiagents4pharma/talk2competitors/__init__.py,sha256=haaikzND3c0Euqq86ndA4fl9q42aOop5rYG_8Zh1D-o,119
58
+ aiagents4pharma/talk2competitors/agents/__init__.py,sha256=ykszlVGxz3egLHZAttlNoTPxIrnQJZYva_ssR8fwIFk,117
59
+ aiagents4pharma/talk2competitors/agents/main_agent.py,sha256=UoHCpZd-HoeG0B6_gAF1cEP2OqMvrTuGe7MZDwL_u1U,3878
60
+ aiagents4pharma/talk2competitors/agents/s2_agent.py,sha256=eTrhc4ZPvWOUWMHNYxK0WltsZedZUnAWNu-TeUa-ruk,2501
61
+ aiagents4pharma/talk2competitors/config/__init__.py,sha256=HyM6paOpKZ5_tZnyVheSAFmxjT6Mb3PxvWKfP0rz-dE,113
62
+ aiagents4pharma/talk2competitors/config/config.py,sha256=jd4ltMBJyTztm9wT7j3ujOyYxL2SXRgxQJ4OZUBmCG4,5387
63
+ aiagents4pharma/talk2competitors/state/__init__.py,sha256=DzFjV3hZNes_pL4bDW2_8RsyK9BJcj6ejfBzU0KWn1k,106
64
+ aiagents4pharma/talk2competitors/state/state_talk2competitors.py,sha256=GUl1ZfM77XsjIEu-3xy4dtvaiMTA1pXf6i1ozVcX5Gg,993
65
+ aiagents4pharma/talk2competitors/tests/__init__.py,sha256=U3PsTiUZaUBD1IZanFGkDIOdFieDVJtGKQ5-woYUo8c,45
66
+ aiagents4pharma/talk2competitors/tests/test_langgraph.py,sha256=sEROK1aU3wFqJhZohONVI6Pr7t1d3PSqs-4erVIyiJw,9283
67
+ aiagents4pharma/talk2competitors/tools/__init__.py,sha256=YudBDRwaEzDnAcpxGZvEOfyh5-6xd51CTvTKTkywgXw,68
68
+ aiagents4pharma/talk2competitors/tools/s2/__init__.py,sha256=9RQH3efTj6qkXk0ICKSc7Mzpkitt4gRGsQ1pGPrrREU,181
69
+ aiagents4pharma/talk2competitors/tools/s2/display_results.py,sha256=B8JJGohi1Eyx8C3MhO_SiyQP3R6hPyUKJOAzcHmq3FU,584
70
+ aiagents4pharma/talk2competitors/tools/s2/multi_paper_rec.py,sha256=FYLt47DAk6WOKfEk1Gj9zVvJGNyxA283PCp8IKW9U5M,4262
71
+ aiagents4pharma/talk2competitors/tools/s2/search.py,sha256=pppjrQv5-8ep4fnqgTSBNgnbSnQsVIcNrRrH0p2TP1o,4025
72
+ aiagents4pharma/talk2competitors/tools/s2/single_paper_rec.py,sha256=dAfUQxI7T5eu0eDxK8VAl7-JH0Wnw24CVkOQqwj-hXc,4810
73
+ aiagents4pharma/talk2knowledgegraphs/__init__.py,sha256=4smVQoSMM6rflVnNkABqlDAAlSn4bYsq7rMVWjRGvis,103
74
+ aiagents4pharma/talk2knowledgegraphs/datasets/__init__.py,sha256=L3gPuHskSegmtXskVrLIYr7FXe_ibKgJ2GGr1_Wok6k,173
75
+ aiagents4pharma/talk2knowledgegraphs/datasets/biobridge_primekg.py,sha256=QlzDXmXREoa9MA6-GwzqRjdzndQeGBAF11Td6NFk_9Y,23426
76
+ aiagents4pharma/talk2knowledgegraphs/datasets/dataset.py,sha256=-LaPLse8BkALqwFetNK7wch2dt9Dz6QKGKZKBKM6bIk,409
77
+ aiagents4pharma/talk2knowledgegraphs/datasets/primekg.py,sha256=KBMhCJ7yjMWqQJJctFYdpjYAlwv48Jl6i1dddXP4f08,7599
78
+ aiagents4pharma/talk2knowledgegraphs/datasets/starkqa_primekg.py,sha256=Y-6-nORsnBJlU6rH0skyfr9S9J4PfTWK-af_p5UuknQ,7483
79
+ aiagents4pharma/talk2knowledgegraphs/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
+ aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_biobridge_primekg.py,sha256=crH0eFA3P8P6IYzi1UWNa4YvRVrtlBzoScf9NaE1lDk,9827
81
+ aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_dataset.py,sha256=NFUlsZvhfIrkF4YenWfahrLK93Xhm5UYEGG_uYN2LVM,566
82
+ aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_primekg.py,sha256=Pvu0r93CpnhjkfMxc-EiVLpAJ04FdW9iTamCnetu654,2272
83
+ aiagents4pharma/talk2knowledgegraphs/tests/test_datasets_starkqa_primekg.py,sha256=TuIsqcN1Mww3DTqGk6ebgJBWzUWdMWEq2yRQuYSFqvA,4416
84
+ aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_embeddings.py,sha256=uYFoE_6zeU10_1mLLAHUr5c4S2XZMSc0Q_860o-KWEw,1517
85
+ aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_huggingface.py,sha256=EINWyXg_3AMHF3WzFLhIUiFDuaEhTVHBvVAJr8VtMDg,1624
86
+ aiagents4pharma/talk2knowledgegraphs/tests/test_utils_embeddings_sentencetransformer.py,sha256=Qxo6WeIDRy8aLh1tNKw0kSlzmUj3MtTak63oW2YwB24,1327
87
+ aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_enrichments.py,sha256=N6HRr4lWHXY7bTHe2uXJe4D_EG9WqZPibZne6qLl9_k,1447
88
+ aiagents4pharma/talk2knowledgegraphs/tests/test_utils_enrichments_ollama.py,sha256=kMuB_vci6hKr2qJgXBmcje7yxeJ2nY2ImXw-NSJpts0,3912
89
+ aiagents4pharma/talk2knowledgegraphs/utils/__init__.py,sha256=X8kSpmDTMkeE0fA5D0CWMsQ52YKoM5rRSXrjnali3IM,97
90
+ aiagents4pharma/talk2knowledgegraphs/utils/kg_utils.py,sha256=6vQnPkeOWae_8jePjhma3sJuMTngy0I0tqzdFt6OqKg,2507
91
+ aiagents4pharma/talk2knowledgegraphs/utils/embeddings/__init__.py,sha256=xRb0x7SoAb0nSVZYgjrqxWvENOMDuqIdL43NMjoOaCs,153
92
+ aiagents4pharma/talk2knowledgegraphs/utils/embeddings/embeddings.py,sha256=1nGznrAj-xT0xuSMBGz2dOujJ7M_IwSR84njxtxsy9A,2523
93
+ aiagents4pharma/talk2knowledgegraphs/utils/embeddings/huggingface.py,sha256=2vi_elf6EgzfagFAO5QnL3a_aXZyN7B1EBziu44MTfM,3806
94
+ aiagents4pharma/talk2knowledgegraphs/utils/embeddings/sentence_transformer.py,sha256=36iKlisOpMtGR5xfTAlSHXWvPqVC_Jbezod8kbBBMVg,2136
95
+ aiagents4pharma/talk2knowledgegraphs/utils/enrichments/__init__.py,sha256=tW426knki2DBIHcWyF_K04iMMdbpIn_e_TpPmTgz2dI,113
96
+ aiagents4pharma/talk2knowledgegraphs/utils/enrichments/enrichments.py,sha256=Bx8x6zzk5614ApWB90N_iv4_Y_Uq0-KwUeBwYSdQMU4,924
97
+ aiagents4pharma/talk2knowledgegraphs/utils/enrichments/ollama.py,sha256=8eoxR-VHo0G7ReQIwje7xEhE-SJlHdef7_wJRpnvFIc,4116
98
+ aiagents4pharma-1.15.0.dist-info/LICENSE,sha256=IcIbyB1Hyk5ZDah03VNQvJkbNk2hkBCDqQ8qtnCvB4Q,1077
99
+ aiagents4pharma-1.15.0.dist-info/METADATA,sha256=ZgQceTwuYCV7Ma8Jtrf2YUghjuvwebo9F0yXlLRuciA,8637
100
+ aiagents4pharma-1.15.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
101
+ aiagents4pharma-1.15.0.dist-info/top_level.txt,sha256=-AH8rMmrSnJtq7HaAObS78UU-cTCwvX660dSxeM7a0A,16
102
+ aiagents4pharma-1.15.0.dist-info/RECORD,,
@@ -1,240 +0,0 @@
1
- '''
2
- Test cases for Talk2Biomodels.
3
- '''
4
-
5
- import pandas as pd
6
- from langchain_core.messages import HumanMessage, ToolMessage
7
- from ..agents.t2b_agent import get_app
8
-
9
- def test_get_modelinfo_tool():
10
- '''
11
- Test the get_modelinfo tool.
12
- '''
13
- unique_id = 12345
14
- app = get_app(unique_id)
15
- config = {"configurable": {"thread_id": unique_id}}
16
- # Update state
17
- app.update_state(config,
18
- {"sbml_file_path": ["aiagents4pharma/talk2biomodels/tests/BIOMD0000000449_url.xml"]})
19
- prompt = "Extract all relevant information from the uploaded model."
20
- # Test the tool get_modelinfo
21
- response = app.invoke(
22
- {"messages": [HumanMessage(content=prompt)]},
23
- config=config
24
- )
25
- assistant_msg = response["messages"][-1].content
26
- # Check if the assistant message is a string
27
- assert isinstance(assistant_msg, str)
28
-
29
- def test_search_models_tool():
30
- '''
31
- Test the search_models tool.
32
- '''
33
- unique_id = 12345
34
- app = get_app(unique_id)
35
- config = {"configurable": {"thread_id": unique_id}}
36
- # Update state
37
- app.update_state(config, {"llm_model": "gpt-4o-mini"})
38
- prompt = "Search for models on Crohn's disease."
39
- # Test the tool get_modelinfo
40
- response = app.invoke(
41
- {"messages": [HumanMessage(content=prompt)]},
42
- config=config
43
- )
44
- assistant_msg = response["messages"][-1].content
45
- # Check if the assistant message is a string
46
- assert isinstance(assistant_msg, str)
47
- # Check if the assistant message contains the
48
- # biomodel id BIO0000000537
49
- assert "BIOMD0000000537" in assistant_msg
50
-
51
- def test_ask_question_tool():
52
- '''
53
- Test the ask_question tool without the simulation results.
54
- '''
55
- unique_id = 12345
56
- app = get_app(unique_id, llm_model='gpt-4o-mini')
57
- config = {"configurable": {"thread_id": unique_id}}
58
-
59
- ##########################################
60
- # Test ask_question tool when simulation
61
- # results are not available i.e. the
62
- # simulation has not been run. In this
63
- # case, the tool should return an error
64
- ##########################################
65
- # Update state
66
- app.update_state(config, {"llm_model": "gpt-4o-mini"})
67
- # Define the prompt
68
- prompt = "Call the ask_question tool to answer the "
69
- prompt += "question: What is the concentration of CRP "
70
- prompt += "in serum at 1000 hours? The simulation name "
71
- prompt += "is `simulation_name`."
72
- # Invoke the tool
73
- app.invoke(
74
- {"messages": [HumanMessage(content=prompt)]},
75
- config=config
76
- )
77
- # Get the messages from the current state
78
- # and reverse the order
79
- current_state = app.get_state(config)
80
- reversed_messages = current_state.values["messages"][::-1]
81
- # Loop through the reversed messages until a
82
- # ToolMessage is found.
83
- for msg in reversed_messages:
84
- # Assert that the message is a ToolMessage
85
- # and its status is "error"
86
- if isinstance(msg, ToolMessage):
87
- assert msg.status == "error"
88
-
89
- def test_simulate_model_tool():
90
- '''
91
- Test the simulate_model tool when simulating
92
- multiple models.
93
- '''
94
- unique_id = 123
95
- app = get_app(unique_id)
96
- config = {"configurable": {"thread_id": unique_id}}
97
- app.update_state(config, {"llm_model": "gpt-4o-mini"})
98
- # Upload a model to the state
99
- app.update_state(config,
100
- {"sbml_file_path": ["aiagents4pharma/talk2biomodels/tests/BIOMD0000000449_url.xml"]})
101
- prompt = "Simulate models 64 and the uploaded model"
102
- # Invoke the agent
103
- app.invoke(
104
- {"messages": [HumanMessage(content=prompt)]},
105
- config=config
106
- )
107
- current_state = app.get_state(config)
108
- dic_simulated_data = current_state.values["dic_simulated_data"]
109
- # Check if the dic_simulated_data is a list
110
- assert isinstance(dic_simulated_data, list)
111
- # Check if the length of the dic_simulated_data is 2
112
- assert len(dic_simulated_data) == 2
113
- # Check if the source of the first model is 64
114
- assert dic_simulated_data[0]['source'] == 64
115
- # Check if the source of the second model is upload
116
- assert dic_simulated_data[1]['source'] == "upload"
117
- # Check if the data of the first model contains
118
- assert '1,3-bisphosphoglycerate' in dic_simulated_data[0]['data']
119
- # Check if the data of the second model contains
120
- assert 'mTORC2' in dic_simulated_data[1]['data']
121
-
122
- def test_integration():
123
- '''
124
- Test the integration of the tools.
125
- '''
126
- unique_id = 123
127
- app = get_app(unique_id)
128
- config = {"configurable": {"thread_id": unique_id}}
129
- app.update_state(config, {"llm_model": "gpt-4o-mini"})
130
- # ##########################################
131
- # ## Test simulate_model tool
132
- # ##########################################
133
- prompt = "Simulate the model 537 for 2016 hours and intervals"
134
- prompt += " 2016 with an initial concentration of `DoseQ2W` "
135
- prompt += "set to 300 and `Dose` set to 0. Reset the concentration"
136
- prompt += " of `NAD` to 100 every 500 hours."
137
- # Test the tool get_modelinfo
138
- response = app.invoke(
139
- {"messages": [HumanMessage(content=prompt)]},
140
- config=config
141
- )
142
- assistant_msg = response["messages"][-1].content
143
- print (assistant_msg)
144
- # Check if the assistant message is a string
145
- assert isinstance(assistant_msg, str)
146
- ##########################################
147
- # Test ask_question tool when simulation
148
- # results are available
149
- ##########################################
150
- # Update state
151
- app.update_state(config, {"llm_model": "gpt-4o-mini"})
152
- prompt = "What is the concentration of CRP in serum at 1000 hours? "
153
- # prompt += "Show only the concentration, rounded to 1 decimal place."
154
- # prompt += "For example, if the concentration is 0.123456, "
155
- # prompt += "your response should be `0.1`. Do not return any other information."
156
- # Test the tool get_modelinfo
157
- response = app.invoke(
158
- {"messages": [HumanMessage(content=prompt)]},
159
- config=config
160
- )
161
- assistant_msg = response["messages"][-1].content
162
- # print (assistant_msg)
163
- # Check if the assistant message is a string
164
- assert "1.7" in assistant_msg
165
-
166
- ##########################################
167
- # Test custom_plotter tool when the
168
- # simulation results are available
169
- ##########################################
170
- prompt = "Plot only CRP related species."
171
-
172
- # Update state
173
- app.update_state(config, {"llm_model": "gpt-4o-mini"}
174
- )
175
- # Test the tool get_modelinfo
176
- response = app.invoke(
177
- {"messages": [HumanMessage(content=prompt)]},
178
- config=config
179
- )
180
- assistant_msg = response["messages"][-1].content
181
- current_state = app.get_state(config)
182
- # Get the messages from the current state
183
- # and reverse the order
184
- reversed_messages = current_state.values["messages"][::-1]
185
- # Loop through the reversed messages
186
- # until a ToolMessage is found.
187
- expected_header = ['Time', 'CRP[serum]', 'CRPExtracellular']
188
- expected_header += ['CRP Suppression (%)', 'CRP (% of baseline)']
189
- expected_header += ['CRP[liver]']
190
- predicted_artifact = []
191
- for msg in reversed_messages:
192
- if isinstance(msg, ToolMessage):
193
- # Work on the message if it is a ToolMessage
194
- # These may contain additional visuals that
195
- # need to be displayed to the user.
196
- if msg.name == "custom_plotter":
197
- predicted_artifact = msg.artifact
198
- break
199
- # Convert the artifact into a pandas dataframe
200
- # for easy comparison
201
- df = pd.DataFrame(predicted_artifact)
202
- # Extract the headers from the dataframe
203
- predicted_header = df.columns.tolist()
204
- # Check if the header is in the expected_header
205
- # assert expected_header in predicted_artifact
206
- assert set(expected_header).issubset(set(predicted_header))
207
- ##########################################
208
- # Test custom_plotter tool when the
209
- # simulation results are available but
210
- # the species is not available
211
- ##########################################
212
- prompt = "Plot the species `TP53`."
213
-
214
- # Update state
215
- app.update_state(config, {"llm_model": "gpt-4o-mini"}
216
- )
217
- # Test the tool get_modelinfo
218
- response = app.invoke(
219
- {"messages": [HumanMessage(content=prompt)]},
220
- config=config
221
- )
222
- assistant_msg = response["messages"][-1].content
223
- # print (response["messages"])
224
- current_state = app.get_state(config)
225
- # Get the messages from the current state
226
- # and reverse the order
227
- reversed_messages = current_state.values["messages"][::-1]
228
- # Loop through the reversed messages until a
229
- # ToolMessage is found.
230
- predicted_artifact = []
231
- for msg in reversed_messages:
232
- if isinstance(msg, ToolMessage):
233
- # Work on the message if it is a ToolMessage
234
- # These may contain additional visuals that
235
- # need to be displayed to the user.
236
- if msg.name == "custom_plotter":
237
- predicted_artifact = msg.artifact
238
- break
239
- # Check if the the predicted artifact is `None`
240
- assert predicted_artifact is None