VirtualPatientEngine / AIAgents4Pharma

AI Agents for drug discovery, drug development, and other pharmaceutical R&D
MIT License
0 stars 1 forks source link

"Describe the model" fails with error after running a simulation of another model #26

Open dmccloskey opened 5 days ago

dmccloskey commented 5 days ago

Describe the bug Asking the chatbot to "Describe the model" results in an application error. The error never seems to occur after starting a new Code Ocean instance, but occurs after simulation two models.

To Reproduce Steps to reproduce the behavior:

  1. Run the streamlit application
  2. Ask the chatbot to e.g., "simulate model 64 ..."
  3. Ask the chatbot to "Describe the model" (works)
  4. Ask the chatbot to e.g., "simulate model 104 ..." or refresh the webpage
  5. Ask the chatbot to "Describe the model" (fails)

Error message

2024-11-17 04:03:23.433 Uncaught app exception Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling result = func() File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec exec(code, module.dict) File "/root/capsule/code/AIAgents4Pharma/app/frontend/streamlit_app.py", line 111, in response = agent_executor.invoke({"input": prompt, File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 170, in invoke raise e File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 160, in invoke self._call(inputs, run_manager=run_manager) File "/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py", line 1629, in _call next_step_output = self._take_next_step( File "/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py", line 1335, in _take_next_step [ File "/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py", line 1335, in [ File "/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py", line 1420, in _iter_next_step yield self._perform_agent_action( File "/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py", line 1442, in _perform_agent_action observation = tool.run( File "/opt/conda/lib/python3.10/site-packages/langchain_core/tools/base.py", line 689, in run raise error_to_raise File "/opt/conda/lib/python3.10/site-packages/langchain_core/tools/base.py", line 651, in run tool_args, tool_kwargs = self._to_args_and_kwargs(tool_input) File "/opt/conda/lib/python3.10/site-packages/langchain_core/tools/base.py", line 574, in _to_args_and_kwargs tool_input = self._parse_input(tool_input) File "/opt/conda/lib/python3.10/site-packages/langchain_core/tools/base.py", line 515, in _parse_input result = input_args.model_validate(tool_input) File "/opt/conda/lib/python3.10/site-packages/pydantic/main.py", line 596, in model_validate return cls.__pydantic_validator__.validate_python( pydantic_core._pydantic_core.ValidationError: 1 validation error for ModelDescriptionInput sys_bio_model.model_object Value error, Either model_id or sbml_file_path must be provided. [type=value_error, input_value={}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/value_error /opt/conda/lib/python3.10/site-packages/pydantic/_internal/_fields.py:132: UserWarning:

Field "model_data" in simulatemodel has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = ().

Screenshots (optional) See last few seconds https://github.com/user-attachments/assets/0c7cbc3a-5a40-4be6-b9ab-0cdf31d7486a

Desktop (please complete the following information):

Additional context (optional)