Skip to content
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

[BUG] Using variable from the API request #3551

Open
rodrigocpaiva opened this issue Nov 22, 2024 · 1 comment
Open

[BUG] Using variable from the API request #3551

rodrigocpaiva opened this issue Nov 22, 2024 · 1 comment
Labels
question Further information is requested

Comments

@rodrigocpaiva
Copy link

rodrigocpaiva commented Nov 22, 2024

Describe the bug

I'm running an API request and sending some variables to use in the prompt, but the variable values are not becoming available in Flowise.

To Reproduce

Execute the cURL:

curl https://eduzen-flowise.dsuuxu.easypanel.host/api/v1/prediction/86424544-6fed-4fb8-84fc-e97e517d8712 \ -X POST \ -d '{"question": "What is my name?","overrideConfig": {"vars": {"user_name": "Rodrigo"}}}' \ -H "Content-Type: application/json"

Expected behavior

I expected the output "Your name is Rodrigo".

System message

User name: {{$vars.user_name}}. You are a helpful assistant. Please include the user's name in your answers.

I tried to refer to the variable in several different ways, including {{$user_name}}, without success.

**Security settings"""

I allowed overrideConfig on settings
Screenshot 2024-11-22 at 10 28 38


Flow

{
  "nodes": [
    {
      "id": "conversationalAgent_0",
      "position": {
        "x": 749.2050594648011,
        "y": 15.581491234964744
      },
      "type": "customNode",
      "data": {
        "id": "conversationalAgent_0",
        "label": "Conversational Agent",
        "version": 3,
        "name": "conversationalAgent",
        "type": "AgentExecutor",
        "baseClasses": [
          "AgentExecutor",
          "BaseChain",
          "Runnable"
        ],
        "category": "Agents",
        "description": "Conversational agent for a chat model. It will utilize chat specific prompts",
        "inputParams": [
          {
            "label": "System Message",
            "name": "systemMessage",
            "type": "string",
            "rows": 4,
            "default": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.",
            "optional": true,
            "additionalParams": true,
            "id": "conversationalAgent_0-input-systemMessage-string"
          },
          {
            "label": "Max Iterations",
            "name": "maxIterations",
            "type": "number",
            "optional": true,
            "additionalParams": true,
            "id": "conversationalAgent_0-input-maxIterations-number"
          }
        ],
        "inputAnchors": [
          {
            "label": "Allowed Tools",
            "name": "tools",
            "type": "Tool",
            "list": true,
            "id": "conversationalAgent_0-input-tools-Tool"
          },
          {
            "label": "Chat Model",
            "name": "model",
            "type": "BaseChatModel",
            "id": "conversationalAgent_0-input-model-BaseChatModel"
          },
          {
            "label": "Memory",
            "name": "memory",
            "type": "BaseChatMemory",
            "id": "conversationalAgent_0-input-memory-BaseChatMemory"
          },
          {
            "label": "Input Moderation",
            "description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
            "name": "inputModeration",
            "type": "Moderation",
            "optional": true,
            "list": true,
            "id": "conversationalAgent_0-input-inputModeration-Moderation"
          }
        ],
        "inputs": {
          "tools": [],
          "model": "{{chatOpenAI_0.data.instance}}",
          "memory": "{{conversationSummaryBufferMemory_0.data.instance}}",
          "systemMessage": "User name: {{user_name}}.\n\nYou are a helpful assistant. Include the user name in the answer.",
          "inputModeration": "",
          "maxIterations": ""
        },
        "outputAnchors": [
          {
            "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain|Runnable",
            "name": "conversationalAgent",
            "label": "AgentExecutor",
            "description": "Conversational agent for a chat model. It will utilize chat specific prompts",
            "type": "AgentExecutor | BaseChain | Runnable"
          }
        ],
        "outputs": {},
        "selected": false
      },
      "width": 300,
      "height": 435,
      "positionAbsolute": {
        "x": 749.2050594648011,
        "y": 15.581491234964744
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "conversationSummaryBufferMemory_0",
      "position": {
        "x": 311.5513274993276,
        "y": 723.0141860288845
      },
      "type": "customNode",
      "data": {
        "id": "conversationSummaryBufferMemory_0",
        "label": "Conversation Summary Buffer Memory",
        "version": 1,
        "name": "conversationSummaryBufferMemory",
        "type": "ConversationSummaryBufferMemory",
        "baseClasses": [
          "ConversationSummaryBufferMemory",
          "BaseConversationSummaryMemory",
          "BaseChatMemory",
          "BaseMemory"
        ],
        "category": "Memory",
        "description": "Uses token length to decide when to summarize conversations",
        "inputParams": [
          {
            "label": "Max Token Limit",
            "name": "maxTokenLimit",
            "type": "number",
            "default": 2000,
            "description": "Summarize conversations once token limit is reached. Default to 2000",
            "id": "conversationSummaryBufferMemory_0-input-maxTokenLimit-number"
          },
          {
            "label": "Session Id",
            "name": "sessionId",
            "type": "string",
            "description": "If not specified, a random id will be used. Learn <a target=\"_blank\" href=\"https://docs.flowiseai.com/memory#ui-and-embedded-chat\">more</a>",
            "default": "",
            "optional": true,
            "additionalParams": true,
            "id": "conversationSummaryBufferMemory_0-input-sessionId-string"
          },
          {
            "label": "Memory Key",
            "name": "memoryKey",
            "type": "string",
            "default": "chat_history",
            "additionalParams": true,
            "id": "conversationSummaryBufferMemory_0-input-memoryKey-string"
          }
        ],
        "inputAnchors": [
          {
            "label": "Chat Model",
            "name": "model",
            "type": "BaseChatModel",
            "id": "conversationSummaryBufferMemory_0-input-model-BaseChatModel"
          }
        ],
        "inputs": {
          "model": "{{chatOpenAI_0.data.instance}}",
          "maxTokenLimit": 2000,
          "sessionId": "",
          "memoryKey": "chat_history"
        },
        "outputAnchors": [
          {
            "id": "conversationSummaryBufferMemory_0-output-conversationSummaryBufferMemory-ConversationSummaryBufferMemory|BaseConversationSummaryMemory|BaseChatMemory|BaseMemory",
            "name": "conversationSummaryBufferMemory",
            "label": "ConversationSummaryBufferMemory",
            "description": "Uses token length to decide when to summarize conversations",
            "type": "ConversationSummaryBufferMemory | BaseConversationSummaryMemory | BaseChatMemory | BaseMemory"
          }
        ],
        "outputs": {},
        "selected": false
      },
      "width": 300,
      "height": 382,
      "selected": false,
      "positionAbsolute": {
        "x": 311.5513274993276,
        "y": 723.0141860288845
      },
      "dragging": false
    },
    {
      "id": "chatOpenAI_0",
      "position": {
        "x": 305.1572063572089,
        "y": 23.164337995035112
      },
      "type": "customNode",
      "data": {
        "id": "chatOpenAI_0",
        "label": "ChatOpenAI",
        "version": 7,
        "name": "chatOpenAI",
        "type": "ChatOpenAI",
        "baseClasses": [
          "ChatOpenAI",
          "BaseChatModel",
          "BaseLanguageModel",
          "Runnable"
        ],
        "category": "Chat Models",
        "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
        "inputParams": [
          {
            "label": "Connect Credential",
            "name": "credential",
            "type": "credential",
            "credentialNames": [
              "openAIApi"
            ],
            "id": "chatOpenAI_0-input-credential-credential"
          },
          {
            "label": "Model Name",
            "name": "modelName",
            "type": "asyncOptions",
            "loadMethod": "listModels",
            "default": "gpt-3.5-turbo",
            "id": "chatOpenAI_0-input-modelName-asyncOptions"
          },
          {
            "label": "Temperature",
            "name": "temperature",
            "type": "number",
            "step": 0.1,
            "default": 0.9,
            "optional": true,
            "id": "chatOpenAI_0-input-temperature-number"
          },
          {
            "label": "Max Tokens",
            "name": "maxTokens",
            "type": "number",
            "step": 1,
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-maxTokens-number"
          },
          {
            "label": "Top Probability",
            "name": "topP",
            "type": "number",
            "step": 0.1,
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-topP-number"
          },
          {
            "label": "Frequency Penalty",
            "name": "frequencyPenalty",
            "type": "number",
            "step": 0.1,
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-frequencyPenalty-number"
          },
          {
            "label": "Presence Penalty",
            "name": "presencePenalty",
            "type": "number",
            "step": 0.1,
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-presencePenalty-number"
          },
          {
            "label": "Timeout",
            "name": "timeout",
            "type": "number",
            "step": 1,
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-timeout-number"
          },
          {
            "label": "BasePath",
            "name": "basepath",
            "type": "string",
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-basepath-string"
          },
          {
            "label": "Proxy Url",
            "name": "proxyUrl",
            "type": "string",
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-proxyUrl-string"
          },
          {
            "label": "Stop Sequence",
            "name": "stopSequence",
            "type": "string",
            "rows": 4,
            "optional": true,
            "description": "List of stop words to use when generating. Use comma to separate multiple stop words.",
            "additionalParams": true,
            "id": "chatOpenAI_0-input-stopSequence-string"
          },
          {
            "label": "BaseOptions",
            "name": "baseOptions",
            "type": "json",
            "optional": true,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-baseOptions-json"
          },
          {
            "label": "Allow Image Uploads",
            "name": "allowImageUploads",
            "type": "boolean",
            "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, Conversational Agent, Tool Agent",
            "default": false,
            "optional": true,
            "id": "chatOpenAI_0-input-allowImageUploads-boolean"
          },
          {
            "label": "Image Resolution",
            "description": "This parameter controls the resolution in which the model views the image.",
            "name": "imageResolution",
            "type": "options",
            "options": [
              {
                "label": "Low",
                "name": "low"
              },
              {
                "label": "High",
                "name": "high"
              },
              {
                "label": "Auto",
                "name": "auto"
              }
            ],
            "default": "low",
            "optional": false,
            "additionalParams": true,
            "id": "chatOpenAI_0-input-imageResolution-options"
          }
        ],
        "inputAnchors": [
          {
            "label": "Cache",
            "name": "cache",
            "type": "BaseCache",
            "optional": true,
            "id": "chatOpenAI_0-input-cache-BaseCache"
          }
        ],
        "inputs": {
          "cache": "",
          "modelName": "gpt-4o-mini",
          "temperature": "0.7",
          "maxTokens": "",
          "topP": "",
          "frequencyPenalty": "",
          "presencePenalty": "",
          "timeout": "",
          "basepath": "",
          "proxyUrl": "",
          "stopSequence": "",
          "baseOptions": "",
          "allowImageUploads": "",
          "imageResolution": "low"
        },
        "outputAnchors": [
          {
            "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
            "name": "chatOpenAI",
            "label": "ChatOpenAI",
            "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
            "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
          }
        ],
        "outputs": {},
        "selected": false
      },
      "width": 300,
      "height": 670,
      "selected": false,
      "dragging": false,
      "positionAbsolute": {
        "x": 305.1572063572089,
        "y": 23.164337995035112
      }
    },
    {
      "id": "setVariable_0",
      "position": {
        "x": 833.03210028541,
        "y": 557.1932376882114
      },
      "type": "customNode",
      "data": {
        "id": "setVariable_0",
        "label": "Set Variable",
        "version": 2,
        "name": "setVariable",
        "type": "SetVariable",
        "baseClasses": [
          "SetVariable",
          "Utilities"
        ],
        "tags": [
          "Utilities"
        ],
        "category": "Utilities",
        "description": "Set variable which can be retrieved at a later stage. Variable is only available during runtime.",
        "inputParams": [
          {
            "label": "Variable Name",
            "name": "variableName",
            "type": "string",
            "placeholder": "var1",
            "id": "setVariable_0-input-variableName-string"
          }
        ],
        "inputAnchors": [
          {
            "label": "Input",
            "name": "input",
            "type": "string | number | boolean | json | array",
            "optional": true,
            "list": true,
            "id": "setVariable_0-input-input-string | number | boolean | json | array"
          }
        ],
        "inputs": {
          "input": "",
          "variableName": "user_name"
        },
        "outputAnchors": [
          {
            "name": "output",
            "label": "Output",
            "type": "options",
            "description": "",
            "options": [
              {
                "id": "setVariable_0-output-output-string|number|boolean|json|array",
                "name": "output",
                "label": "Output",
                "description": "",
                "type": "string | number | boolean | json | array"
              }
            ],
            "default": "output"
          }
        ],
        "outputs": {
          "output": "output"
        },
        "selected": false
      },
      "width": 300,
      "height": 356,
      "selected": false,
      "dragging": false,
      "positionAbsolute": {
        "x": 833.03210028541,
        "y": 557.1932376882114
      }
    }
  ],
  "edges": [
    {
      "source": "conversationSummaryBufferMemory_0",
      "sourceHandle": "conversationSummaryBufferMemory_0-output-conversationSummaryBufferMemory-ConversationSummaryBufferMemory|BaseConversationSummaryMemory|BaseChatMemory|BaseMemory",
      "target": "conversationalAgent_0",
      "targetHandle": "conversationalAgent_0-input-memory-BaseChatMemory",
      "type": "buttonedge",
      "id": "conversationSummaryBufferMemory_0-conversationSummaryBufferMemory_0-output-conversationSummaryBufferMemory-ConversationSummaryBufferMemory|BaseConversationSummaryMemory|BaseChatMemory|BaseMemory-conversationalAgent_0-conversationalAgent_0-input-memory-BaseChatMemory"
    },
    {
      "source": "chatOpenAI_0",
      "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
      "target": "conversationalAgent_0",
      "targetHandle": "conversationalAgent_0-input-model-BaseChatModel",
      "type": "buttonedge",
      "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-conversationalAgent_0-conversationalAgent_0-input-model-BaseChatModel"
    },
    {
      "source": "chatOpenAI_0",
      "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
      "target": "conversationSummaryBufferMemory_0",
      "targetHandle": "conversationSummaryBufferMemory_0-input-model-BaseChatModel",
      "type": "buttonedge",
      "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-conversationSummaryBufferMemory_0-conversationSummaryBufferMemory_0-input-model-BaseChatModel"
    }
  ]
}
@HenryHengZJ
Copy link
Contributor

you have to create the variable first, then enable it in override config tab:
https://docs.flowiseai.com/using-flowise/variables#override-or-setting-variable-through-api

@HenryHengZJ HenryHengZJ added the question Further information is requested label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants