Remove --code feature, closes #24, refs #23, #17

This commit is contained in:
Simon Willison 2023-06-15 18:42:17 +01:00
parent 62b90d92bc
commit d72ac8779a
2 changed files with 0 additions and 16 deletions

View file

@ -59,9 +59,3 @@ This is useful for piping content to standard input, for example:
curl -s 'https://simonwillison.net/2023/May/15/per-interpreter-gils/' | \
llm --system 'Suggest topics for this post as a JSON array' --stream
The `--code` option will set a system prompt for you that attempts to output just code without explanation, and will strip off any leading or trailing markdown code block syntax. You can use this to generate code and write it straight to a file:
llm 'Python CLI tool: reverse string passed to stdin' --code > fetch.py
Be _very careful_ executing code generated by a LLM - always read it first!

View file

@ -13,11 +13,6 @@ import warnings
warnings.simplefilter("ignore", ResourceWarning)
CODE_SYSTEM_PROMPT = """
You are a code generating tool. Return just the code, with no explanation
or context other than comments in the code itself.
""".strip()
DEFAULT_MODEL = "gpt-3.5-turbo"
@ -52,7 +47,6 @@ def cli():
help="Continue the conversation with the given chat ID.",
type=int,
)
@click.option("--code", is_flag=True, help="System prompt to optimize for code output")
@click.option("--key", help="API key to use")
def prompt(prompt, system, gpt4, model, stream, no_log, code, _continue, chat_id, key):
"Execute a prompt against on OpenAI model"
@ -62,10 +56,6 @@ def prompt(prompt, system, gpt4, model, stream, no_log, code, _continue, chat_id
openai.api_key = get_key(key, "openai", "OPENAI_API_KEY")
if gpt4:
model = "gpt-4"
if code and system:
raise click.ClickException("Cannot use --code and --system together")
if code:
system = CODE_SYSTEM_PROMPT
messages = []
if _continue:
_continue = -1