{"id":13565775,"url":"https://github.com/monarch-initiative/ontogpt","last_synced_at":"2025-04-08T11:14:51.469Z","repository":{"id":66914579,"uuid":"584843480","full_name":"monarch-initiative/ontogpt","owner":"monarch-initiative","description":"LLM-based ontological extraction tools, including SPIRES","archived":false,"fork":false,"pushed_at":"2024-06-07T17:38:19.000Z","size":68013,"stargazers_count":539,"open_issues_count":84,"forks_count":67,"subscribers_count":18,"default_branch":"main","last_synced_at":"2024-06-11T16:36:02.628Z","etag":null,"topics":["ai","chat-gpt","data-modeling","gpt-3","information-extraction","language-models","large-language-models","linkml","llm","monarchinitiative","named-entity-recognition","ner","nlp","oaklib","obofoundry","relation-extraction"],"latest_commit_sha":null,"homepage":"https://monarch-initiative.github.io/ontogpt/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monarch-initiative.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-03T16:53:25.000Z","updated_at":"2024-08-12T17:00:27.016Z","dependencies_parsed_at":"2023-10-19T20:04:11.574Z","dependency_job_id":"e69a8234-1e0b-417b-a56f-d8d974a9e385","html_url":"https://github.com/monarch-initiative/ontogpt","commit_stats":{"total_commits":845,"total_committers":21,"mean_commits":40.23809523809524,"dds":0.3183431952662722,"last_synced_commit":"449b08103888ae8472d64f2dabbee545f860aa36"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarch-initiative%2Fontogpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarch-initiative%2Fontogpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarch-initiative%2Fontogpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarch-initiative%2Fontogpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monarch-initiative","download_url":"https://codeload.github.com/monarch-initiative/ontogpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829512,"owners_count":21002997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chat-gpt","data-modeling","gpt-3","information-extraction","language-models","large-language-models","linkml","llm","monarchinitiative","named-entity-recognition","ner","nlp","oaklib","obofoundry","relation-extraction"],"created_at":"2024-08-01T13:01:55.208Z","updated_at":"2025-04-08T11:14:51.449Z","avatar_url":"https://github.com/monarch-initiative.png","language":"Jupyter Notebook","funding_links":[],"categories":["NLP","Jupyter Notebook"],"sub_categories":[],"readme":"# OntoGPT\n\n![OntoGPT Logo](/images/ontogpt_logo_3.jpg)\n\n[![DOI](https://zenodo.org/badge/13996/monarch-initiative/ontogpt.svg)](https://zenodo.org/badge/latestdoi/13996/monarch-initiative/ontogpt)\n![PyPI](https://img.shields.io/pypi/v/ontogpt)\n\n## Introduction\n\n_OntoGPT_ is a Python package for extracting structured information from text with large language models (LLMs), _instruction prompts_, and ontology-based grounding.\n\n[For more details, please see the full documentation.](https://monarch-initiative.github.io/ontogpt/)\n\n## Quick Start\n\nOntoGPT runs on the command line, though there's also a minimal web app interface (see `Web Application` section below).\n\n1. Ensure you have Python 3.9 or greater installed.\n2. Install with `pip`:\n\n    ```bash\n    pip install ontogpt\n    ```\n\n3. Set your OpenAI API key:\n\n    ```bash\n    runoak set-apikey -e openai \u003cyour openai api key\u003e\n    ```\n\n4. See the list of all OntoGPT commands:\n\n    ```bash\n    ontogpt --help\n    ```\n\n5. Try a simple example of information extraction:\n\n    ```bash\n    echo \"One treatment for high blood pressure is carvedilol.\" \u003e example.txt\n    ontogpt extract -i example.txt -t drug\n    ```\n\n    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`.\n\n## Web Application\n\nThere is a bare bones web application for running OntoGPT and viewing results.\n\nFirst, install the required dependencies with `pip` by running the following command:\n\n```bash\npip install ontogpt[web]\n```\n\nThen run this command to start the web application:\n\n```bash\nweb-ontogpt\n```\n\nNOTE: We do not recommend hosting this webapp publicly without authentication.\n\n## Model APIs\n\nOntoGPT uses the `litellm` package (\u003chttps://litellm.vercel.app/\u003e) to interface with LLMs.\n\nThis means most APIs are supported, including OpenAI, Azure, Anthropic, Mistral, Replicate, and beyond.\n\nThe model name to use may be found from the command `ontogpt list-models` - use the name in the first column with the `--model` option.\n\nIn most cases, this will require setting the API key for a particular service as above:\n\n```bash\nrunoak set-apikey -e anthropic-key \u003cyour anthropic api key\u003e\n```\n\nSome endpoints, such as OpenAI models through Azure, require setting additional details. These may be set similarly:\n\n```bash\nrunoak set-apikey -e azure-key \u003cyour azure api key\u003e\nrunoak set-apikey -e azure-base \u003cyour azure endpoint url\u003e\nrunoak set-apikey -e azure-version \u003cyour azure api version, e.g. \"2023-05-15\"\u003e\n```\n\nThese details may also be set as environment variables as follows:\n\n```bash\nexport AZURE_API_KEY=\"my-azure-api-key\"\nexport AZURE_API_BASE=\"https://example-endpoint.openai.azure.com\"\nexport AZURE_API_VERSION=\"2023-05-15\"\n```\n\n## Open Models\n\nOpen LLMs may be retrieved and run through the `ollama` package (\u003chttps://ollama.com/\u003e).\n\nYou will need to install `ollama` (see the [GitHub repo](https://github.com/ollama/ollama)), and you may need to start it as a service with a command like `ollama serve` or `sudo systemctl start ollama`.\n\nThen retrieve a model with `ollama pull \u003cmodelname\u003e`, e.g., `ollama pull llama3`.\n\nThe model may then be used in OntoGPT by prefixing its name with `ollama/`, e.g., `ollama/llama3`, along with the `--model` option.\n\nSome ollama models may not be listed in `ontogpt list-models` but the full list of downloaded LLMs can be seen with `ollama list` command.\n\n## Evaluations\n\nOntoGPT's functions have been evaluated on test data. Please see the full documentation for details on these evaluations and how to reproduce them.\n\n## Related Projects\n\n* [TALISMAN](https://github.com/monarch-initiative/talisman/), a tool for generating summaries of functions enriched within a gene set. TALISMAN uses OntoGPT to work with LLMs.\n\n## Tutorials and Presentations\n\n* 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)\n  * [Slides](https://docs.google.com/presentation/d/1rMQVWaMju-ucYFif5nx4Xv3bNX2SVI_w89iBIT1bkV4/edit?usp=sharing)\n  * [Video](https://www.youtube.com/watch?v=z38lI6WyBsY)\n* 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)\n  * [Slides](https://docs.google.com/presentation/d/1LsOTKi-rXYczL9vUTHB1NDkaEqdA9u3ZFC5ANa0x1VU/edit?usp=sharing)\n  * [Video](https://www.youtube.com/watch?v=a34Yjz5xPp4)\n* Presentation: \"OntoGPT: A framework for working with ontologies and large language models\" - talk by Chris Mungall at Joint Food Ontology Workgroup (May 2023)\n  * [Slides](https://docs.google.com/presentation/d/1CosJJe8SqwyALyx85GWkw9eOT43B4HwDlAY2CmkmJgU/edit)\n  * [Video](https://www.youtube.com/watch?v=rt3wobA9hEs\u0026t=1955s)\n\n## Citation\n\nThe 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. _Bioinformatics_, Volume 40, Issue 3, March 2024, btae104, [https://doi.org/10.1093/bioinformatics/btae104](https://doi.org/10.1093/bioinformatics/btae104).\n\n## Acknowledgements\n\nThis project is part of the [Monarch Initiative](https://monarchinitiative.org/). We also gratefully acknowledge [Bosch Research](https://www.bosch.com/research) for their support of this research project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonarch-initiative%2Fontogpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonarch-initiative%2Fontogpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonarch-initiative%2Fontogpt/lists"}