### Text Completion Example Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/operation.md Use this command for a simple text completion task to verify OntoGPT setup. Provide input text in a file. ```bash ontogpt complete example.txt ``` -------------------------------- ### Install OntoGPT from GitHub Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/setup.md Clone the OntoGPT repository from GitHub and install it using `uv` for development or contribution. ```bash git clone https://github.com/monarch-initiative/ontogpt.git cd ontogpt/ uv pip install . ``` -------------------------------- ### Install OntoGPT from GitHub with Extras Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/setup.md Install OntoGPT from a GitHub clone, including optional dependencies using `uv`. ```bash uv pip install -e .[extra_name] ``` -------------------------------- ### Install OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/notebooks/Quick-Examples.ipynb Installs the OntoGPT library with web support. Run this command in your terminal or notebook. ```python %pip install ontogpt[web] ``` -------------------------------- ### Install OntoGPT with Web Dependencies Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Install OntoGPT along with the necessary dependencies for the web application interface. ```bash pip install ontogpt[web] ``` -------------------------------- ### Install OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Install the OntoGPT package using pip. Ensure you have Python 3.10 to 3.13 installed. ```bash pip install ontogpt ``` -------------------------------- ### Convert Training Examples from YAML Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Converts training examples from YAML format to JSON. This is often necessary for evaluation purposes. The input YAML file should contain a list of examples with 'prompt' and 'completion' fields. ```bash ontogpt convert-examples inputfile.yaml ``` -------------------------------- ### Install OntoGPT and Import Libraries Source: https://github.com/monarch-initiative/ontogpt/blob/main/notebooks/BioEPIC_demo.ipynb Installs the ontogpt library and imports necessary modules for YAML processing and pretty printing. ```python %pip install ontogpt import yaml import pprint ``` -------------------------------- ### Install OntoGPT with Optional Dependencies Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/setup.md Install OntoGPT with specific optional dependencies for features like development, documentation, recipe scraping, or web applications. ```bash pip install ontogpt[extra_name] ``` -------------------------------- ### Basic Information Extraction Example Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Perform a simple information extraction task using OntoGPT. This example extracts drug information from a text file. ```bash echo "One treatment for high blood pressure is carvedilol." > example.txt ontogpt extract -i example.txt -t drug ``` -------------------------------- ### Start OntoGPT Web Application Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Launch the minimal web application for running OntoGPT and viewing results. It is not recommended to host this publicly without authentication. ```bash web-ontogpt ``` -------------------------------- ### Start OntoGPT Web Interface Source: https://github.com/monarch-initiative/ontogpt/blob/main/notebooks/Quick-Examples.ipynb Starts the OntoGPT web interface. Uvicorn will run on http://127.0.0.1:8000. Stop the server by interrupting the notebook kernel. ```bash !web-ontogpt ``` -------------------------------- ### Example Schema Header Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/custom.md This is an example of a schema header using LinkML. It defines metadata, prefixes for namespaces, default prefix and range, and imports other schemas. ```yaml id: http://w3id.org/ontogpt/gocam name: gocam-template title: GO-CAM Template description: >- A template for GO-CAMs license: https://creativecommons.org/publicdomain/zero/1.0/ prefixes: linkml: https://w3id.org/linkml/ gocam: http://w3id.org/ontogpt/gocam/ GO: http://purl.obolibrary.org/obo/GO_ CL: http://purl.obolibrary.org/obo/CL_ default_prefix: gocam default_range: string imports: - linkml:types - core ``` -------------------------------- ### convert-examples Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Converts training examples from YAML format to JSON format, which can be necessary for evaluations. ```APIDOC ## convert-examples ### Description Convert training examples from YAML. This can be necessary for performing evaluations. Given the path to a YAML-format input file containing training examples in a format like this: ```yaml --- examples: - prompt: completion: - prompt: completion: ``` the function will convert it to equivalent JSON. ### Example ```bash ontogpt convert-examples inputfile.yaml ``` ``` -------------------------------- ### Extract with OpenAI-compatible Proxy Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/operation.md Example of using the extract command with an OpenAI-compatible proxy server, specifying the base URL and model provider. ```bash ontogpt -vvv extract -t go_terms -i temp/genetest.txt -m anthropic/claude-opus --model-provider openai --api-base "https://api.cborg.lbl.gov" ``` -------------------------------- ### OntoGPT Raw Completion Output Example Source: https://github.com/monarch-initiative/ontogpt/blob/main/tests/output/cli/treatment-schiz.md This is a raw completion output from OntoGPT, detailing various aspects of schizophrenia treatment. It includes drugs, treatments, contraindications, mechanisms, efficacies, and adverse effects, serving as input for structured data extraction. ```text disease: schizophrenia drugs: clozapine treatments: second-generation antipsychotics (SGAs); first-generation antipsychotics (FGAs); electroconvulsive therapy (ECT); mood stabilizer contraindications: clozapine treatment_mechanisms: second-generation antipsychotics (SGAs)*fewer extrapyramidal symptoms; first-generation antipsychotics (FGAs)*not specified; clozapine*not specified; electroconvulsive therapy (ECT)*not specified; mood stabilizer*not specified treatment_efficacies: second-generation antipsychotics (SGAs)*first-line treatment; clozapine*effective at stage 3; electroconvulsive therapy (ECT)*effective at stage 4 and 6; first-generation antipsychotics (FGAs)*effective at stage 5 and 6; mood stabilizer*effective at stage 6 treatment_adverse_effects: second-generation antipsychotics (SGAs)*weight gain; second-generation antipsychotics (SGAs)*hyperlipidemia; second-generation antipsychotics (SGAs)*diabetes mellitus; clozapine*agranulocytosis ``` -------------------------------- ### Example of Generated Prompt for Nested Schema Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/custom.md Shows the prompt generated for a nested schema attribute, indicating how the structure is translated for LLM processing. ```bash gene_functions : ``` -------------------------------- ### Example OWL Ontology Structure Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/start_with_owl.md This is a basic example of an OWL ontology defining classes and individuals, represented in RDF/XML format. ```xml Apple Orange ``` -------------------------------- ### List Available Templates Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Displays the available templates for use with OntoGPT. This can also be achieved by running `make list_templates`. ```bash ontogpt list-templates ``` -------------------------------- ### List Available Models Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Lists all models that `litellm` recognizes. This command is useful for understanding which language models are accessible through the OntoGPT interface. ```bash ontogpt list-models ``` -------------------------------- ### Show All Prompts in OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use the --show-prompt option, typically with high verbosity (-vvv), to display all prompts constructed and sent to the LLM. This is off by default. ```bash ontogpt -vvv --show-prompt ``` -------------------------------- ### JavaScript for Loading Indicator Source: https://github.com/monarch-initiative/ontogpt/blob/main/src/ontogpt/webapp/html/form.html Handles the display of a loading indicator and disables the submit button when an operation starts. This function should be called before initiating a long-running process. ```javascript function showLoading() { document.getElementById("loading").style.display = "block"; document.getElementById("submitBtn").disabled = true; } ``` -------------------------------- ### Suggest Template for Topic Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Suggests an appropriate OntoGPT template for a given topic or purpose using an LLM. All options supported by 'extract' or 'complete' functions are available. ```bash ontogpt suggest-template "Takotsubo Cardiomyopathy" ``` -------------------------------- ### Provide System Message Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use `system-message` to pass a system-level instruction to the LLM. This can guide the model's behavior and output format, helping to avoid parsing failures. ```bash $ ontogpt complete -m llama-3 -i greeting.txt I'm just a language model, I don't have emotions or feelings like humans do, so I don't have good or bad days. I'm always here and ready to chat with you, 24/7! How can I assist you today? ``` ```bash $ ontogpt complete -m llama-3 -i greeting.txt --system-message "You are very grumpy today" *grumble grumble* I'm terrible, thanks for asking. Everything is just so... annoying. The sun is shining too brightly, the birds are singing too loudly, and the air is filled with the scent of... *sigh*... everything. Just, ugh. Can't anyone just leave me alone for once? What's it to you, anyway? *mutter mutter* ``` ```bash --system-message "You are going to extract information from text in the specified format. You will not deviate from the format; do not provide results in JSON format." ``` -------------------------------- ### View OntoGPT Commands Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Display a list of all available OntoGPT commands in the terminal. ```bash ontogpt --help ``` -------------------------------- ### List Downloaded Ollama Models Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/operation.md Lists all language models currently downloaded and available through Ollama. ```bash ollama list ``` -------------------------------- ### Fill Missing Values in Data Object Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use this command to fill in missing values within a data object. It requires the path to the data object file and a file containing examples. ```bash ontogpt fill -E path/to/examples.json path/to/data.json ``` -------------------------------- ### Structured Field Extraction Example Source: https://github.com/monarch-initiative/ontogpt/blob/main/tests/output/test-output.md This snippet shows the expected structured output after processing the prompt for field extraction. It clearly defines the 'food' and 'state' fields based on the input text. ```text food: sauce + noodles state: ``` -------------------------------- ### Specify Output File for OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use the --output option to specify a path for the output file. If omitted, OntoGPT writes to standard output. ```bash ontogpt --output results.txt ``` -------------------------------- ### Set Groq API Key Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/setup.md Configure your Groq API key using the `runoak` command-line tool. ```bash runoak set-apikey -e groq-key ``` -------------------------------- ### Set PYSTOW_HOME environment variable Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/troubleshooting.md To change the download location for OntoGPT annotator files, set the PYSTOW_HOME environment variable to your preferred path. This example shows how to set it for the current session. ```bash export PYSTOW_HOME='/tmp/' ``` -------------------------------- ### Extract Text from PDF using OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use the --use-pdf option to enable text extraction from PDF files via the pymupdf package. This example demonstrates extracting composite disease information. ```bash ontogpt extract -i temp/test1.pdf -m gpt-4o --use-pdf -t composite_disease --output-format json -o test.json ``` -------------------------------- ### Extract Structured Fields from Text Source: https://github.com/monarch-initiative/ontogpt/blob/main/tests/output/test-output.md This example demonstrates how to prompt OntoGPT to split text into structured fields, specifically extracting 'food' and 'state' from a given text. It's useful for parsing semi-structured input. ```prompt Split the following piece of text into fields in the following format: food: state: Text: sauce + noodles === ``` -------------------------------- ### Extract Treatment Adverse Effects Source: https://github.com/monarch-initiative/ontogpt/blob/main/tests/output/cli/treatment-schiz.md This example demonstrates how to prompt OntoGPT to split text into treatment and adverse effects fields. It is useful for parsing raw completion outputs related to drug treatments and their side effects. ```text Split the following piece of text into fields in the following format: treatment: adverse_effects: Text: clozapineagranulocytosis === ``` -------------------------------- ### complete Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Provides prompt completion by passing the content of a given file to the model. ```APIDOC ## complete ### Description Prompt completion. Given the path to a file containing text to continue, this command will simply pass it to the model as a completion task. ### Example The file `example2.txt` contains the text "Here's a good joke about high blood pressure:" ```bash ontogpt complete example2.txt ``` We take no responsibility for joke quality or lack thereof. ``` -------------------------------- ### Extract Knowledge from Text with Schema Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Extract knowledge from text guided by a schema. This function supports manual slot value setting and can output detailed extracted objects, named entities, and their labels. It is OntoGPT's implementation of SPIRES. ```bash ontogpt extract -t gocam.GoCamAnnotations -i tests/input/cases/gocam-33246504.txt ``` ```yaml extracted_object: genes: - HGNC:5992 - AUTO:F4/80 - HGNC:16400 - HGNC:1499 - HGNC:5992 - HGNC:5993 organisms: - NCBITaxon:10088 - AUTO:bone%20marrow-derived%20macrophages - AUTO:astrocytes - AUTO:bipolar%20cells - AUTO:vascular%20cells - AUTO:perivascular%20MPs gene_organisms: - gene: HGNC:5992 organism: AUTO:mononuclear%20phagocytes - gene: HGNC:16400 organism: AUTO:F4/80%2B%20mononuclear%20phagocytes - gene: HGNC:1499 organism: AUTO:F4/80%2B%20mononuclear%20phagocytes - gene: HGNC:5992 organism: AUTO:perivascular%20macrophages - gene: HGNC:5993 organism: AUTO:None activities: - GO:0006954 - AUTO:photoreceptor%20death - AUTO:retinal%20function gene_functions: - gene: HGNC:5992 molecular_activity: GO:0006954 - gene: AUTO:F4/80 molecular_activity: AUTO:mononuclear%20phagocyte%20recruitment - gene: HGNC:1499 molecular_activity: GO:0006954 - gene: HGNC:5992 molecular_activity: AUTO:immune-specific%20expression - gene: HGNC:5993 molecular_activity: AUTO:IL-1%CE%B2%20receptor - gene: AUTO:rytvela molecular_activity: AUTO:IL-1R%20modulation - gene: AUTO:Kineret molecular_activity: AUTO:IL-1R%20antagonism cellular_processes: - AUTO:macrophage-induced%20photoreceptor%20death gene_localizations: - gene: HGNC:5992 location: AUTO:subretinal%20space ``` ```bash ontogpt extract -t drug -i tests/input/cases/drug-DB00316-moa.txt --auto-prefix UNKNOWN -m gpt-4 ``` ```bash ontogpt extract -t ontology_class -i tests/input/cases/human_urban_green_space.txt ``` -------------------------------- ### Knowledge Extraction with Templates Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/operation.md Extracts knowledge from a text file into a specified data model. Use 'ontogpt list-templates' to see available templates. ```bash ontogpt extract -t gocam.GoCamAnnotations -i ~/path/to/abstract.txt ``` -------------------------------- ### Specify Output Format for OntoGPT Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Use the --output-format option to select the desired output file format from a list including html, json, jsonl, md, owl, pickle, turtle, and yaml. ```bash ontogpt --output-format json ``` -------------------------------- ### Iterative Ontology Generation and Extraction Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md This command iteratively applies the `generate-extract` process to build an ontology. It requires specifying an input ontology and an output path for the generated data. Use the `--clear` flag to reset the output database before starting. ```bash ontogpt iteratively-generate-extract -t cell_type -r sqlite:obo:cl -D cells.yaml CL:0002623 ``` -------------------------------- ### Set HuggingFace API Key Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/setup.md Configure your HuggingFace API key using the `runoak` command-line tool. ```bash runoak set-apikey -e huggingface-key ``` -------------------------------- ### Complete Text Prompt from File Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/functions.md Passes the content of a specified file to the model for text completion. The file should contain the text to be continued. ```bash ontogpt complete example2.txt ``` -------------------------------- ### Set OpenAI API Key Source: https://github.com/monarch-initiative/ontogpt/blob/main/docs/index.md Configure your OpenAI API key for use with OntoGPT. Replace with your actual key. ```bash runoak set-apikey -e openai ```