From d72ac8779aa5b073642e0febe321cf53772dd968 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 15 Jun 2023 18:42:17 +0100 Subject: [PATCH] Remove --code feature, closes #24, refs #23, #17 --- docs/usage.md | 6 ------ llm/cli.py | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 3a662d1..02ac9eb 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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! diff --git a/llm/cli.py b/llm/cli.py index caf73a2..108374a 100644 --- a/llm/cli.py +++ b/llm/cli.py @@ -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