chemsource is a Python tool for exposomics research that classifies chemical compounds based on their exposure sources. It retrieves information from Wikipedia and PubMed, then uses large language models to classify chemicals into user-defined categories.
from chemsource import ChemSource
# Initialize with your OpenAI API key
chem = ChemSource(model_api_key="your_openai_api_key")
# Classify a compound
info, classification = chem.chemsource("aspirin")
print(f"Classification: {classification}")Install from PyPI:
pip install chemsourceFor detailed documentation, tutorials, and API reference, visit:
The documentation includes:
- Installation and setup instructions
- Comprehensive API reference
- Usage examples and tutorials
- Configuration options
- Error handling guides
- Python 3.8+
- OpenAI (or other LLM) API key (for classification)
- NCBI API key (optional, for enhanced PubMed access)
This project is licensed under the MIT License - see the LICENSE file for details.
If you use chemsource in your research, please cite: (Preprint coming soon)
Note: chemsource uses OpenAI's API services which incur costs based on usage. New users receive $5 in free credits, sufficient for testing purposes. Other lower-cost endpoints are also available for classification (e.g. DeepSeek, gpt-oss, etc.). In particular, as of the creation of this package, Google Gemini provides a reasonable amount of free API credits.