Skip to content

Error: "all messages must have non-empty content except for the optional final assistant message" #16

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

Closed
dpiponi opened this issue Mar 6, 2024 · 0 comments

Comments

@dpiponi
Copy link

dpiponi commented Mar 6, 2024

Running bash under MacOS and using Anthropic I get the error

"all messages must have non-empty content except for the optional final assistant message"

after the first use of ctrl-X A.

It could be a usage error by me...

Here is a log file:

{
  "model": "claude-3-sonnet-20240229",
  "max_tokens": 256,
  "system": "You are an assistant who provides executable commands for the bash command-line interface. You only provide the requested command on a single line, without any explanations, hints or other adornments. Stop providing output after the providing the requested command. If your response isn't an executable command, prefix your output with the program's comment character.",
  "messages": [
    {"role": "user", "content": "List files in current directory"},
    {"role": "assistant", "content": "ls"},
    {"role": "user", "content": "How many JavaScript files in the current directory contain the word bar?"},
    {"role": "assistant", "content": "grep -lw bar *.js | wc -l"},
    {"role": "user", "content": "xyzzy"},
    {"role": "assistant", "content": "# Sorry I can't help."},
    {"role": "user", "content": "Before my final prompt to which I expect a reply, I am also supplying you as context with one or more previously issued commands, to which you simply reply OK"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "exit"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "hello"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "exit"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "list all files"}
  ]
}
{"id":"msg_0145uVDCZc1xf4HyvQyvvE2S","type":"message","role":"assistant","content":[{"type":"text","text":"ls"}],"model":"claude-3-sonnet-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":202,"output_tokens":4}}{
  "model": "claude-3-sonnet-20240229",
  "max_tokens": 256,
  "system": "You are an assistant who provides executable commands for the bash command-line interface. You only provide the requested command on a single line, without any explanations, hints or other adornments. Stop providing output after the providing the requested command. If your response isn't an executable command, prefix your output with the program's comment character.",
  "messages": [
    {"role": "user", "content": "List files in current directory"},
    {"role": "assistant", "content": "ls"},
    {"role": "user", "content": "How many JavaScript files in the current directory contain the word bar?"},
    {"role": "assistant", "content": "grep -lw bar *.js | wc -l"},
    {"role": "user", "content": "xyzzy"},
    {"role": "assistant", "content": "# Sorry I can't help."},
    {"role": "user", "content": "Before my final prompt to which I expect a reply, I am also supplying you as context with one or more previously issued commands, to which you simply reply OK"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "exit"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": ""},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "ls"},
    {"role": "assistant", "content": "OK"},
    {"role": "user", "content": "list all files including subdirectories"}
  ]
}
{"type":"error","error":{"type":"invalid_request_error","message":"messages: all messages must have non-empty content except for the optional final assistant message"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants