Integrate ChARGe RSA algorithm - #194
Conversation
db3ade3 to
2e99d29
Compare
34c7019 to
3d87dfc
Compare
tbennun
left a comment
There was a problem hiding this comment.
Overall this looks great! Prompts are well-written etc. The code itself should be refactored to a separate top-level function or file that is called from within ai_based_retrosynthesis since it is quite lengthy. Additionally, some code duplication exists in this PR, as well as a potential merge conflict.
2c54c24 to
29864d7
Compare
799b869 to
8921db6
Compare
0ffd898 to
8921db6
Compare
| task=None, | ||
| agent_name=f"retrosynth_{node_id}_proposal_{proposal_counter[0]}", | ||
| callback=independent_callback, | ||
| ) | ||
|
|
||
| output, final_result = await rsa_task.run_rsa( |
There was a problem hiding this comment.
it's a bit strange that we extend Task but then end up not using the built in API to run a task with a created Agent. If we only extend Task by name, there is no reason to extend it. I think we should use it and run RSA somehow with the Task. Maybe Task can define a generic run function that in the superclass is just agent.run(instructions=self.system_prompt, task=self.user_prompt) etc. and then RSATask's run will execute run_rsa with the agents?
There was a problem hiding this comment.
Addressed in 835e21e (here) + FLASK-LLNL/ChARGe#124 (deacaa0). Task now has a generic run(agent, ...); RSATask.run overrides to delegate to run_rsa. RSA is now invoked via the Task API in ai_rsa.py. The N-K-T loop and run_rsa are unchanged for backward compatibility. ChARGe#124 to be approved first.
| uvicorn.run( | ||
| app, | ||
| host=host, | ||
| port=args.port, | ||
| ws_ping_timeout=60.0, # Increase websocket ping timeout to 60 seconds | ||
| timeout_keep_alive=75, # Keep connections alive for 75 seconds | ||
| ) | ||
| uvicorn.run(app, host=host, port=args.port) |
There was a problem hiding this comment.
why were these kwargs removed?
There was a problem hiding this comment.
Re-added: Previous commit by BVE.
…docstring - ai.py: remove stale RSAAggregationTask comment - backend_helper_funcs.py: drop PR FLASK-LLNL#194 quote from build_root_node docstring
- Restore backend default to livai (PR FLASK-LLNL#193 default) - Restore upstream MCP endpoint handlers (check-mcp-servers and registered-mcp-servers) and manual_mcp_servers strip/filter, preserving wormhole bearer-token forwarding from PR FLASK-LLNL#193 - Drop the local CheckServersRequest model that shadowed the upstream version in lc_conductor.tool_registration File is now byte-identical to upstream main.
3c10687 to
94e95af
Compare
Summary
Integrate ChARGe RSA into FLASK-Copilot retrosynthesis, with consolidated flag handling, extracted RSA driver, and shared root-node creation. Addresses all PR review comments.
Changes
Backend
charge_backend/retrosynthesis/ai_rsa.py— chemistry-specific RSA driver wrapping ChARGe'sRSATaskvia aRetroRSATasksubclass (overridesformat_candidates,validate_proposal)ai_based_retrosynthesisgainsroot_smiles: Optional[str] = None— creates the root Node itself when called fromcompute;db_then_ai_retrosynthesispath unchangedbuild_root_node(smiles, run_settings) -> Nodeinbackend_helper_funcs.py, reused bytemplate_based_retrosynthesis(dedupe)FlaskRunSettings.use_ai_based; everything readsdata.get("aiOnly", True)at the top level of the WS payloados.path.exists(config_file)checks inai.pyandbackend_manager.py; the consolidated check now lives onlyin
template.py:run_retro_plannerclogger.warning(...)when the model returns no reactants (refusal indicator)Frontend (
flask-app)useAiBased→aiOnly; sent at top level of compute / custom-query / compute-reaction-from payloads (alwayspassed)
combined_customization_modal.tsx,retrosynthesis_customization_content.tsx,types.tsaccordinglyretrosynthesis_customization_content.tsximportsRsaSettingsPanelfromlc-conductor(single source of truth)package-lock.jsonand.gitignoreto upstream main (per review)Prompts (
charge_backend/retrosynthesis/prompts/)rsa_{mode}_system.txt,rsa_{mode}_proposal.txt,rsa_{mode}_aggregation.txtModes
query_reaction_databaseremoved from toolsTesting
test_reactions.dbcharge_backend/tests/test_websocket_callbacks.py2/2Dependencies
RSATaskfromcharge.algorithms)FLASK-LLNL/mainRelated