Merged
Conversation
Collaborator
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
Contributor
There was a problem hiding this comment.
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
Kowalski1024
approved these changes
Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.