Skip to content

Commit

Permalink
Fix #174 - add missing CLI parameters (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh authored Aug 15, 2023
2 parents ef28de1 + 93dcd31 commit b43762b
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/ontogpt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def extract(
@output_format_options
@auto_prefix_option
@click.argument("entity")
def generate_extract(entity, template, output, output_format, **kwargs):
def generate_extract(model, entity, template, output, output_format, **kwargs):
"""Generate text and then extract knowledge from it."""
logging.info(f"Creating for {template}")

Expand Down Expand Up @@ -366,6 +366,7 @@ def generate_extract(entity, template, output, output_format, **kwargs):
)
@click.argument("entity")
def iteratively_generate_extract(
model,
entity,
template,
output,
Expand Down Expand Up @@ -421,7 +422,7 @@ def iteratively_generate_extract(
help="Attempt to parse PubMed Central full text(s) instead of abstract(s) alone.",
)
@click.argument("pmid")
def pubmed_extract(pmid, template, output, output_format, get_pmc, **kwargs):
def pubmed_extract(model, pmid, template, output, output_format, get_pmc, **kwargs):
"""Extract knowledge from a single PubMed ID."""
logging.info(f"Creating for {template}")

Expand Down Expand Up @@ -470,7 +471,7 @@ def pubmed_extract(pmid, template, output, output_format, get_pmc, **kwargs):
help="Attempt to parse PubMed Central full text(s) instead of abstract(s) alone.",
)
@click.argument("search")
def pubmed_annotate(search, template, output, output_format, limit, get_pmc, **kwargs):
def pubmed_annotate(model, search, template, output, output_format, limit, get_pmc, **kwargs):
"""Retrieve a collection of PubMed IDs for a search term; annotate them using a template.
Example:
Expand Down Expand Up @@ -517,7 +518,7 @@ def pubmed_annotate(search, template, output, output_format, limit, get_pmc, **k
@output_format_options
@click.option("--auto-prefix", default="AUTO", help="Prefix to use for auto-generated classes.")
@click.argument("article")
def wikipedia_extract(article, template, output, output_format, **kwargs):
def wikipedia_extract(model, article, template, output, output_format, **kwargs):
"""Extract knowledge from a Wikipedia page."""
if not model:
model = DEFAULT_MODEL
Expand Down Expand Up @@ -557,7 +558,7 @@ def wikipedia_extract(article, template, output, output_format, **kwargs):
help="Keyword to search for (e.g. --keyword therapy). Also obtained from schema",
)
@click.argument("topic")
def wikipedia_search(topic, keyword, template, output, output_format, **kwargs):
def wikipedia_search(model, topic, keyword, template, output, output_format, **kwargs):
"""Extract knowledge from a Wikipedia page."""
if not model:
model = DEFAULT_MODEL
Expand Down Expand Up @@ -606,7 +607,7 @@ def wikipedia_search(topic, keyword, template, output, output_format, **kwargs):
help="Keyword to search for (e.g. --keyword therapy). Also obtained from schema",
)
@click.argument("term_tokens", nargs=-1)
def search_and_extract(term_tokens, keyword, template, output, output_format, **kwargs):
def search_and_extract(model, term_tokens, keyword, template, output, output_format, **kwargs):
"""Search for relevant literature and extract knowledge from it."""
if not model:
model = DEFAULT_MODEL
Expand Down Expand Up @@ -747,7 +748,7 @@ def recipe_extract(model, url, recipes_urls_file, dictionary, output, output_for
@output_option_wb
@output_format_options
@click.argument("input")
def convert(input, output, output_format, **kwargs):
def convert(model, input, output, output_format, **kwargs):
"""Convert output format.
Primarily intended for use with recipe template.
Expand Down Expand Up @@ -925,7 +926,6 @@ def enrichment(
Usage:
ontogpt enrichment -r sqlite:obo:hgnc -U tests/input/genesets/dopamine.yaml
"""
if model:
selectmodel = get_model_by_name(model)
Expand Down Expand Up @@ -994,7 +994,10 @@ def enrichment(
)
@click.argument("text", nargs=-1)
def embed(text, context, output, model, output_format, **kwargs):
"""Embed text."""
"""Embed text.
Not currently supported for open models.
"""
if model:
selectmodel = get_model_by_name(model)
model_source = selectmodel["provider"]
Expand Down Expand Up @@ -1023,7 +1026,10 @@ def embed(text, context, output, model, output_format, **kwargs):
)
@click.argument("text", nargs=-1)
def text_similarity(text, context, output, model, output_format, **kwargs):
"""Embed text."""
"""Embed text.
Not currently supported for open models.
"""
if model:
selectmodel = get_model_by_name(model)
model_source = selectmodel["provider"]
Expand Down Expand Up @@ -1060,7 +1066,10 @@ def text_similarity(text, context, output, model, output_format, **kwargs):
)
@click.argument("text", nargs=-1)
def text_distance(text, context, output, model, output_format, **kwargs):
"""Embed text, calculate euclidian distance between embeddings."""
"""Embed text and calculate euclidian distance between embeddings.
Not currently supported for open models.
"""
if model:
selectmodel = get_model_by_name(model)
model_source = selectmodel["provider"]
Expand Down Expand Up @@ -1131,7 +1140,7 @@ def text_distance(text, context, output, model, output_format, **kwargs):
def entity_similarity(terms, ontology, output, model, output_format, **kwargs):
"""Embed text.
Uses the OpenAI ada embedding model by default, currently: $0.0004 / 1K tokens
Not currently supported for open models.
"""
if model:
selectmodel = get_model_by_name(model)
Expand Down

0 comments on commit b43762b

Please sign in to comment.