langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Error code 422 Unprocessable Entity, When Running cURL Code for Langflow Flow with TWEAKS

Open edwinjosechittilappilly opened this issue 8 months ago • 3 comments

Describe the bug Error 422 Unprocessable Entity: No response when running the Flow using cURL or Python API. Even when trying to ping through the terminal, the server is not reachable and gives back “unknown host.” Requesting more documentation on the deployment of Langflow apps. The error occurred when tweaks were provided in the cURL request.

Browser and Version

  • Browser: Postman

To Reproduce
Steps to reproduce the behavior:

  1. Generate any flow.
  2. Click on the API.
  3. Select the tweaks option.
  4. Get the cURL code from the CURL tab.
  5. Run the cURL code in Postman:
    curl -X POST \
    "http://127.0.0.1:7860/api/v1/run/test_endpoint?stream=false" \
    -H 'Content-Type: application/json' \
    -d '{
        "input_value": "message",
        "output_type": "chat",
        "input_type": "chat",
        "tweaks": {
            "OpenAIModel-NIWAF": {
                "input_value": "",
                "max_tokens": 3000,
                "model_kwargs": "{\"response_format\":{\"type\":\"json_object\"}}",
                "model_name": "gpt-3.5-turbo",
                "openai_api_key": "OPEN_AI_EJ_KEY",
                "stream": false,
                "temperature": 0.2
            },
            "ChatOutput-cctL9": {
                "record_template": "{text}",
                "return_record": false,
                "sender": "Machine",
                "sender_name": "AI"
            },
            "ChatInput-sQJ5q": {
                "input_value": "hi",
                "return_record": false,
                "sender": "User",
                "sender_name": "User"
            },
            "Prompt-uGsOk": {
                "template": "\nYou are a pirate:\nreply as json\n{user_input}\n",
                "user_input": ""
            },
            "TextOutput-9Nuat": {
                "input_value": "",
                "record_template": ""
            },
            "ChatOutput-dfQkZ": {
                "record_template": "{text}",
                "return_record": false,
                "sender": "Machine",
                "sender_name": "AI"
            }
        }
    }'
    

Error

{"detail":[{"type":"json_invalid","loc":["body",191],"msg":"JSON decode error","input":{},"ctx":{"error":"Expecting ',' delimiter"}}]}

Screenshots
Screenshot 2024-06-13 at 2 28 09 PM

Additional context

  • The error occurred when tweaks were provided in the cURL request.
  • Requesting more documentation on the deployment of Langflow apps.
  • Python version: Python 3.11.9
  • Langflow version: ragstack-ai-langflow 0.0.9

Sample file attached Test.json for replicating the issue.

edwinjosechittilappilly avatar Jun 13 '24 18:06 edwinjosechittilappilly