Skip to content

Commit

Permalink
Remove --code feature, closes #24, refs #23, #17
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 15, 2023
1 parent 62b90d9 commit d72ac87
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
6 changes: 0 additions & 6 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
10 changes: 0 additions & 10 deletions llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@

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"


Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit d72ac87

Please sign in to comment.