ChEBI
ChEBI (Chemical Entities of Biological Interest) is both a naming dictionary and an ontology, meaning it records not just names and structures but also how chemical entities relate to one another. You can download the structures as SDF files and the relationships as ontology files.
For RAG, its main value is consistency. By mapping the different names a compound goes by to a single ChEBI identifier, you can link entities across documents and avoid treating the same substance as several different things.
ChEBI is published under CC BY 4.0, so you can use it commercially with attribution.
Related sources
Bio2RDF
An open-source project that pulls together a diverse set of life-sciences datasets from many providers into a single linked-data graph, with a SPARQL endpoint for querying across them. The full collection is about 11 billion triples across 35 datasets, including DrugBank, PubMed, and MeSH.
ChEMBL
A manually curated database of bioactive molecules with drug-like properties, bringing together chemical, bioactivity, and genomic data to support drug discovery. Holds close to 2.5M compound records on nearly 2M unique chemical structures, extracted mainly from the medicinal chemistry literature.
Crystallography Open Database
A collection of over 350,000 crystal structure files covering organic, inorganic, and metal-organic compounds, released into the public domain under CC0.
Materials Project
A database of computed properties for known and predicted materials, produced through high-throughput density functional theory calculations (a physics method for modelling how electrons behave in a material). Free API access with registration.