Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes double call to cell help command #220

Merged
merged 3 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions examples/commands.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,18 @@
" -r, --reset Clears the conversation transcript used when\n",
" interacting with an OpenAI chat model\n",
" provider. Does nothing with other providers.\n",
" --help Show this message and exit.\n",
"------------------------------------------------------------------------------\n",
"Usage: %%ai [OPTIONS] MODEL_ID\n",
"\n",
" Invokes a language model identified by MODEL_ID, with the prompt being\n",
" contained in all lines after the first. Both local model IDs and global\n",
" model IDs (with the provider ID explicitly prefixed, followed by a colon)\n",
" are accepted.\n",
"\n",
" To view available language models, please run `%ai list`.\n",
"\n",
"Options:\n",
" -f, --format [code|html|image|json|markdown|math|md|text]\n",
" IPython display to use when rendering\n",
" output. [default=\"markdown\"]\n",
" -r, --reset Clears the conversation transcript used when\n",
" interacting with an OpenAI chat model\n",
" provider. Does nothing with other providers.\n",
" -n, --region-name TEXT AWS region name, e.g. 'us-east-1'. Required\n",
" for SageMaker provider; does nothing with\n",
" other providers.\n",
" -q, --request-schema TEXT The JSON object the endpoint expects, with\n",
" the prompt being substituted into any value\n",
" that matches the string literal '<prompt>'.\n",
" Required for SageMaker provider; does\n",
" nothing with other providers.\n",
" -p, --response-path TEXT A JSONPath string that retrieves the\n",
" language model's output from the endpoint's\n",
" JSON response. Required for SageMaker\n",
" provider; does nothing with other providers.\n",
" --help Show this message and exit.\n",
"------------------------------------------------------------------------------\n",
"Usage: %ai [OPTIONS] COMMAND [ARGS]...\n",
Expand Down
5 changes: 1 addition & 4 deletions packages/jupyter-ai-magics/jupyter_ai_magics/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,9 @@ class UpdateArgs(BaseModel):
target: str

class LineMagicGroup(click.Group):
"""Helper class to print the help string for cell magics as well when
"""Helper class to print the help string for line magics when
`%ai --help` is called."""
def get_help(self, ctx):
with click.Context(cell_magic_parser, info_name="%%ai") as ctx:
click.echo(cell_magic_parser.get_help(ctx))
click.echo('-' * 78)
with click.Context(line_magic_parser, info_name="%ai") as ctx:
click.echo(super().get_help(ctx))

Expand Down