-
Notifications
You must be signed in to change notification settings - Fork 86
Modify \llm to use either + or - modifiers. #227
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
base: main
Are you sure you want to change the base?
Conversation
aa90344
to
1efcd02
Compare
@@ -86,7 +86,7 @@ def suggest_type(full_text, text_before_cursor): | |||
|
|||
def suggest_special(text): | |||
text = text.lstrip() | |||
cmd, _, arg = parse_special_command(text) | |||
cmd, mode, arg = parse_special_command(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not using the variable, why assign it to a name?
litecli/packages/special/llm.py
Outdated
@@ -293,12 +292,12 @@ def is_llm_command(command) -> bool: | |||
""" | |||
Is this an llm/ai command? | |||
""" | |||
cmd, _, _ = parse_special_command(command) | |||
cmd, mode, arg = parse_special_command(command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are not using these variables, why assign a name?
""" | ||
raw, _, arg = sql.partition(" ") | ||
is_verbose = raw.endswith("+") | ||
is_succinct = raw.endswith("-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we validate for llm+-
and other invalid/unsupported commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did you have in mind? I could see someone calling \llm* Question
or \llm= Question
. It'll just ignore unknown chars and treat them as regular verbosity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to cover two cases: more than 1 special character and unknown special character. Ideally, incorrect usage should not pass silently. What do you think?
""" | ||
raw, _, arg = sql.partition(" ") | ||
is_verbose = raw.endswith("+") | ||
is_succinct = raw.endswith("-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to cover two cases: more than 1 special character and unknown special character. Ideally, incorrect usage should not pass silently. What do you think?
is_verbose = raw.endswith("+") | ||
is_succinct = raw.endswith("-") | ||
# strip out any + or - modifiers to get the actual command name | ||
command = raw.strip().rstrip("+-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to be strict here to check command == llm
.
Following are some cases
>>> raw ="llm+-"
>>> raw.strip().rstrip("+-")
'llm'
>>> raw ="llm*"
>>> raw.strip().rstrip("+-")
'llm*'
Description
The
\llm
command now has three modes. Succinct, Regular and Verbose.Succinct =
\llm-
- This will return just the sql query. No explanation.Regular =
\llm
- This will return just the sql query and the explanation.Verbose =
\llm+
- This will print the prompt sent to the LLM and the sql query and the explanation.Checklist
CHANGELOG.md
file.