Modify \llm to use either + or - modifiers.#227
Conversation
aa90344 to
1efcd02
Compare
| 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.
If we are not using the variable, why assign it to a name?
litecli/packages/special/llm.py
Outdated
| 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.
Since we are not using these variables, why assign a name?
litecli/packages/special/main.py
Outdated
| """ | ||
| raw, _, arg = sql.partition(" ") | ||
| is_verbose = raw.endswith("+") | ||
| is_succinct = raw.endswith("-") |
There was a problem hiding this comment.
Should we validate for llm+- and other invalid/unsupported commands?
There was a problem hiding this comment.
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.
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?
litecli/packages/special/main.py
Outdated
| """ | ||
| raw, _, arg = sql.partition(" ") | ||
| is_verbose = raw.endswith("+") | ||
| is_succinct = raw.endswith("-") |
There was a problem hiding this comment.
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?
litecli/packages/special/main.py
Outdated
| 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.
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*'4722caa to
c9900a5
Compare
Description
The
\llmcommand 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.mdfile.