You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble with a simple flow in the playground and the issues appears to be related to the AGENT component and trying to get a JSON object into the user prompt.
If I create a simple flow with a PROMPT and Chat Input going into the OPENAI component and out to a Chat Output, I can paste in a JSON object into the user chat and get an expected output from the model.
However, if I replace the OpenAI component with an AGENT component (using the gpt-4o as the model), and do the same thing... I get an error in the Agent component
ERROR MESSAGE:
An error occured in the Agent Component, stopping your flow. See below for more details.
Error details:
KeyError
Details: Input to ChatPromptTemplate is missing variables {'\n "PtName"'}. Expected: ['\n "PtName"'] Received: ['input', 'chat_history', 'intermediate_steps', 'agent_scratchpad'] Note: if you intended { "PtName"} to be part of the string and not a variable, please escape it with double curly braces like: '{{ "PtName"}}'. For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/INVALID_PROMPT_INPUT
If I try to escape the JSON with double curly braces that doesn't seem to help.
Interestingly if I then submit an empty user prompt after the error it works as expected.
Reproduction
Create a simple flow with input --> Agent Component --> output
Paste JSON into the user prompt in the playground
Agent Component Errors out
Expected behavior
Agent Component should accept the JSON input.
Who can help?
No response
Operating System
Datastax hosted
Langflow Version
1.1.1
Python Version
None
Screenshot
No response
Flow File
No response
The text was updated successfully, but these errors were encountered:
Hey @drpriceless! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together!
The error you're encountering with the Agent Component when using JSON as input is related to the handling of variables within the ChatPromptTemplate. The error message indicates that the template is expecting a variable {"PtName"} but is not receiving it. This suggests that the JSON input is being interpreted as a variable rather than a string.
To resolve this issue, ensure that any curly braces in your JSON input are properly escaped. If {"PtName"} is intended to be part of the JSON string and not a variable, you should escape it with double curly braces like {{"PtName"}}. This tells the template to treat it as a literal string rather than a placeholder for a variable.
Additionally, verify that your prompt template is correctly set up to handle all required variables. The error message suggests that the expected variables are not being received, so double-check that your input includes all necessary variables and that they are correctly formatted.
If escaping the JSON with double curly braces doesn't help, consider reviewing the structure of your prompt template and the inputs being passed to ensure they align with the expected format. You might also want to inspect the inputs using debugging tools to ensure that all variables are correctly passed to the template.
Bug Description
I am having trouble with a simple flow in the playground and the issues appears to be related to the AGENT component and trying to get a JSON object into the user prompt.
If I create a simple flow with a PROMPT and Chat Input going into the OPENAI component and out to a Chat Output, I can paste in a JSON object into the user chat and get an expected output from the model.
However, if I replace the OpenAI component with an AGENT component (using the gpt-4o as the model), and do the same thing... I get an error in the Agent component
ERROR MESSAGE:
An error occured in the Agent Component, stopping your flow. See below for more details.
Error details:
KeyError
Details: Input to ChatPromptTemplate is missing variables {'\n "PtName"'}. Expected: ['\n "PtName"'] Received: ['input', 'chat_history', 'intermediate_steps', 'agent_scratchpad'] Note: if you intended { "PtName"} to be part of the string and not a variable, please escape it with double curly braces like: '{{ "PtName"}}'. For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/INVALID_PROMPT_INPUT
If I try to escape the JSON with double curly braces that doesn't seem to help.
Interestingly if I then submit an empty user prompt after the error it works as expected.
Reproduction
Create a simple flow with input --> Agent Component --> output
Paste JSON into the user prompt in the playground
Agent Component Errors out
Expected behavior
Agent Component should accept the JSON input.
Who can help?
No response
Operating System
Datastax hosted
Langflow Version
1.1.1
Python Version
None
Screenshot
No response
Flow File
No response
The text was updated successfully, but these errors were encountered: