Skip to main content

INVALID_PROMPT_INPUT

A prompt template received missing or invalid input variables.

Troubleshooting

The following may help resolve this error:

  • Double-check your prompt template to ensure that it is correct.
    • If you are using the default f-string format and you are using curly braces { anywhere in your template, they should be double escaped like this: {{ (and if you want to render a double curly brace, you should use four curly braces: {{{{).
  • If you are using a MessagesPlaceholder, make sure that you are passing in an array of messages or message-like objects.
    • If you are using shorthand tuples to declare your prompt template, make sure that the variable name is wrapped in curly braces (["placeholder", "{messages}"]).
  • Try viewing the inputs into your prompt template using LangSmith or log statements to confirm they appear as expected.
  • If you are pulling a prompt from the LangChain Prompt Hub, try pulling and logging it or running it in isolation with a sample input to confirm that it is what you expect.

Was this page helpful?