-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] Pubchempy #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Pubchempy #23
Conversation
tdadela
commented
Jun 8, 2025
- Added PubChemPy library for accessing PubChem chemical data.
- Registered new tools in main_agent.py for chemical name/SMILES conversion and info retrieval using PubChemPy.
- Updated instructions.txt to document these new functionalities and their usage.
- The agent can now convert between chemical names and SMILES, and fetch detailed compound info, all using authoritative PubChem data.
# Conflicts: # src/reagentai/agents/main/instructions.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates PubChemPy into ReAgentAI to enable chemical name/SMILES conversions and detailed compound information retrieval via the PubChem database.
- Adds
pubchempydependency and implements three new tools (get_smiles_from_name,get_compound_info,get_name_from_smiles) intools/pubchem.py. - Registers these tools in the main agent and updates UI, examples, and constants to surface the new functionality.
- Updates documentation (
instructions.txt,README.md) to describe usage of the PubChem-based features.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/reagentai/ui/app.py | Removed duplicate gr.Examples block and reordered imports |
| src/reagentai/tools/pubchem.py | New PubChem integration functions for SMILES/name conversions and info retrieval |
| src/reagentai/constants.py | Extended example prompts to showcase name/SMILES conversion and compound info |
| src/reagentai/agents/main/main_agent.py | Registered the three new PubChem tools in the agent’s tool list |
| src/reagentai/agents/main/instructions.txt | Documented how to use each new PubChem tool |
| pyproject.toml | Added pubchempy>=1.0.4 dependency |
| README.md | Updated feature list and setup notes for PubChem integration |
Comments suppressed due to low confidence (3)
src/reagentai/tools/pubchem.py:142
- Consider returning
molecular_weightas a numeric value instead of a string to maintain consistent data types and simplify downstream processing. If string format is required, document this clearly in the signature and return-type annotation.
"molecular_weight": str(getattr(compound, \"molecular_weight\", None))
src/reagentai/tools/pubchem.py:91
- The return type annotation uses a bare
listforsynonyms; consider specifyinglist[str]for clarity. Also, useOptional[...]fromtypingfor readability, e.g.,dict[str, Optional[Union[str, List[str]]]].
def get_compound_info(compound_name: str) -> dict[str, str | list | None]:
src/reagentai/tools/pubchem.py:1
- The new PubChem integration functions currently lack unit tests. Add tests for
get_smiles_from_name,get_compound_info, andget_name_from_smilesto verify correct outputs, error handling for invalid inputs, and network-failure scenarios.
import logging