Skip to content

ontogpt

Details

GitHub monarch-initiative/ontogpt
Language Jupyter Notebook
Description LLM-based ontological extraction tools, including SPIRES

Dependencies

External Dependencies

Package Version
python >=3.9,<3.9.7
ruamel.yaml >=0.17.31
Jinja2 {'version': '>=3.1.2', 'optional': True}
aiohttp >=3.8.4
airium >=0.2.5
beautifulsoup4 >=4.11.1
bioc >=2.0.post5
cachier >=2.1.0
class-resolver >=0.4.2
click >=8.1.3
eutils >=0.6.0
fastapi {'version': '>=0.88.0', 'optional': True}
gilda >=1.0.0
gpt4 >=0.0.1
httpx >=0.23.3
huggingface_hub {'version': '>=0.15.1', 'extras': ['huggingface'], 'optional': True}
inflect >=6.0.2
inflection >=0.5.1
jsonlines >=3.1.0
linkml ^1.5.7
linkml-owl ^0.3.0
llm >=0.8
llm-gpt4all {'version': '>=0.2', 'extras': ['gpt4all'], 'optional': True}
myst-parser {'version': '>=0.18.1', 'extras': ['docs'], 'optional': True}
nlpcloud >=1.0.39
oaklib >=0.5.15
openai ^1.10.0
pydantic >=2.4.0
pystow ^0.5.0
python-multipart ^0.0.5
recipe-scrapers {'version': '>=14.35.0', 'extras': ['recipes'], 'optional': True}
requests ^2.31.0
requests-cache >=1.0.1
sphinx {'version': '>=5.3.0', 'extras': ['docs'], 'optional': True}
sphinx-autodoc-typehints {'version': '>=1.19.4', 'extras': ['docs'], 'optional': True}
sphinx-click {'version': '>=4.3.0', 'extras': ['docs'], 'optional': True}
sphinx-rtd-theme {'version': '>=1.0.0', 'extras': ['docs'], 'optional': True}
streamlit >=1.22.0
textract {'version': '*', 'extras': ['textract'], 'optional': True}
tiktoken >=0.3.3
uvicorn {'version': '>=0.20.0', 'optional': True}
wikipedia >=1.4.0
wikipedia-api >=0.5.8
dpath ^2.1.6
toml ^0.10.2
urllib3 <2

Documentation

OntoGPT

DOI PyPI

Introduction

OntoGPT is a Python package for extracting structured information from text with large language models (LLMs), instruction prompts, and ontology-based grounding.

Two different strategies for knowledge extraction are currently implemented in OntoGPT:

For more details, please see the full documentation.

Quick Start

OntoGPT runs on the command line, though there's also a minimal web app interface (see Web Application section below).

  1. Ensure you have Python 3.9 or greater installed.
  2. Install with pip:

    pip install ontogpt
    
  3. Set your OpenAI API key:

    runoak set-apikey -e openai <your openai api key>
    
  4. See the list of all OntoGPT commands:

    ontogpt --help
    
  5. Try a simple example of information extraction:

    echo "One treatment for high blood pressure is carvedilol." > example.txt
    ontogpt extract -i example.txt -t drug
    

    OntoGPT will retrieve the necessary ontologies and output results to the command line. Your output will provide all extracted objects under the heading extracted_object.

Web Application

There is a bare bones web application for running OntoGPT and viewing results.

First, install the required dependencies with pip by running the following command:

pip install ontogpt[web]

Then run this command to start the web application:

web-ontogpt

NOTE: We do not recommend hosting this webapp publicly without authentication.

Evaluations

OpenAI's functions have been evaluated on test data. Please see the full documentation for details on these evaluations and how to reproduce them.

  • TALISMAN, a tool for generating summaries of functions enriched within a gene set. TALISMAN uses OntoGPT to work with LLMs.

Tutorials and Presentations

  • Presentation: "Staying grounded: assembling structured biological knowledge with help from large language models" - presented by Harry Caufield as part of the AgBioData Consortium webinar series (September 2023)
  • Slides
  • Video
  • Presentation: "Transforming unstructured biomedical texts with large language models" - presented by Harry Caufield as part of the BOSC track at ISMB/ECCB 2023 (July 2023)
  • Slides
  • Video
  • Presentation: "OntoGPT: A framework for working with ontologies and large language models" - talk by Chris Mungall at Joint Food Ontology Workgroup (May 2023)
  • Slides
  • Video

Citation

The information extraction approach used in OntoGPT, SPIRES, is described further in: Caufield JH, Hegde H, Emonet V, Harris NL, Joachimiak MP, Matentzoglu N, et al. Structured prompt interrogation and recursive extraction of semantics (SPIRES): A method for populating knowledge bases using zero-shot learning. arXiv publication: http://arxiv.org/abs/2304.02711

Acknowledgements

This project is part of the Monarch Initiative. We also gratefully acknowledge Bosch Research for their support of this research project.