Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pranavkrishnasuresh/chemAgent/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theprocess_input() function is the main entry point for running the ChemAgent. It processes chemistry-related queries, optionally extracts text from images, performs RAG-based information retrieval, and returns comprehensive results including the agent’s response, completion status, and error information.
Function Signature
Parameters
The input query or prompt to process. This should be a chemistry-related question or task, such as:
- IUPAC to SMILES conversion
- Molecular formula calculation
- Property prediction queries
- Chemical reaction synthesis
"Could you provide the SMILES for 4-ethyl-4-methyloxolan-2-one?"Optional path to an image file containing chemistry text. When provided, GPT-4o will extract relevant chemistry-related text from the image to augment the query.The image should contain:
- Chemical structures
- Chemical formulas
- IUPAC names
- Other chemistry-related text
"/path/to/chemistry_diagram.png"Enable RAG (Retrieval-Augmented Generation) to fetch additional information from PubChem database. When enabled, the agent retrieves relevant chemical information to enhance the response accuracy.
Return Value
Returns a tuple containing six elements:Final Response: The last response from the agent containing the answer to the query. Returns
None if the process failed due to recursion limits.Completion Status:
True if the process completed successfully, False if it failed due to GraphRecursionError or other issues.Replanning Attempts: The number of times the agent replanned during execution. Higher values indicate more complex queries. Returns
0 if the process failed.LlaSMol Response: The raw response from the LlaSMol model. Contains detailed model output for chemistry-specific tasks. Returns
None if the model was not used or execution failed.LlaSMol Errors: Error messages from chemistry parsing and SMILES validation. Multiple errors are separated by
$ characters. Returns empty string if no errors occurred.Formatted Input: The input query after being structured and tagged by the planner. Shows how the agent interpreted and reformatted the original prompt with
<SMILES> and <IUPAC> tags.Usage Examples
Basic Usage
With Image Extraction
With RAG Enhancement
Handling Errors
Supported Query Types
Error Handling
The function handles several error scenarios:Configuration
The function uses these configuration settings:- Recursion Limit: Maximum 50 planning/execution cycles
- LLM Model: GPT-4o for planning and replanning
- Chemistry Model: LlaSMol-Mistral-7B for specialized chemistry tasks
- RAG Source: PubChem database for chemical information retrieval
Notes
The agent automatically structures your input by adding
<SMILES> and <IUPAC> tags. You can see the formatted version in the returned tuple.