[GH-ISSUE #4652] [BUG]: The resultVariable be removed after executeLLMInstruction. #2952

Closed
opened 2026-02-22 18:31:59 -05:00 by yindo · 1 comment
Owner

Originally created by @playerC on GitHub (Nov 13, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4652

Originally assigned to: @shatfield4 on GitHub.

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

I use Tencent Hunyuan-lite with openAPI interface.

Part of my Agentflow.

   {
      "type": "start",
      "config": {
        "variables": [
          {
            "name": "keywords",
            "value": ""
          },
          {
            "name": "ResponseText",
            "value": "1"
          }
        ]
      }
    },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "## Rules:\n\n- add the  title  before the JSON output.\n    title : `Online Search Result of  \"${keywords}\"` \n- Only keep the data under all `<item>` tags.\n- Use `item` as root object in output JSON .\n- The information under each `<item>` tag is described as follows:\n\n   Title (title);\n   Web link (link);\n   Description (description);\n   Publish time (pubDate);\n\n- output example :\n\n```\n## Online Search Result of \"AI\"\n```JSON\n{\nitem :[...]\n}\n```\n```\n\nPlease output the following RSS content in JSON format according to the rules:\n\n```\n${ResponseText}\n```",
        "resultVariable": "ResponseText",
        "directOutput": true
      }
    }

After executeLLMInstruction , it returns NULL , and the NULL is set to ResponseText , just like it remove the var.
and I can't use the var ResponseText in next step.

After adding some log , I found that:

https://github.com/Mintplex-Labs/anything-llm/blob/71cd46ce1be775eeeb7e1e09fc608549fc17dc8e/server/utils/agentFlows/executors/llm-instruction.js#L36

The completion object don't have the result member, it have 'textResponse'

And I add this code before return ,it works fine.

if (completion["textResponse"]){
completion["result"] =completion.textResponse;
}

But I don't know if it is correct. please check.

Are there known steps to reproduce?

AnythingLLM Desktop APP , v1.9.0.

Create a Agentflow , just like this:

 {
      "type": "start",
      "config": {
        "variables": [
          {
            "name": "keywords",
            "value": ""
          },
          {
            "name": "ResponseText",
            "value": "1"
          }
        ]
      }
    },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "This var will be replaced with 1 , ${ResponseText}",
        "resultVariable": "ResponseText",
        "directOutput": NULL
      },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "This var will not be replaced ${ResponseText}",
        "resultVariable": "",
        "directOutput": true
      }
    }

The second instruction use the resultVariable from the first one ,will not be replaced .

Originally created by @playerC on GitHub (Nov 13, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4652 Originally assigned to: @shatfield4 on GitHub. ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? I use Tencent Hunyuan-lite with openAPI interface. Part of my Agentflow. ``` { "type": "start", "config": { "variables": [ { "name": "keywords", "value": "" }, { "name": "ResponseText", "value": "1" } ] } }, { "type": "llmInstruction", "config": { "instruction": "## Rules:\n\n- add the title before the JSON output.\n title : `Online Search Result of \"${keywords}\"` \n- Only keep the data under all `<item>` tags.\n- Use `item` as root object in output JSON .\n- The information under each `<item>` tag is described as follows:\n\n Title (title);\n Web link (link);\n Description (description);\n Publish time (pubDate);\n\n- output example :\n\n```\n## Online Search Result of \"AI\"\n```JSON\n{\nitem :[...]\n}\n```\n```\n\nPlease output the following RSS content in JSON format according to the rules:\n\n```\n${ResponseText}\n```", "resultVariable": "ResponseText", "directOutput": true } } ``` After executeLLMInstruction , it returns NULL , and the NULL is set to `ResponseText` , just like it remove the var. and I can't use the var `ResponseText` in next step. After adding some log , I found that: https://github.com/Mintplex-Labs/anything-llm/blob/71cd46ce1be775eeeb7e1e09fc608549fc17dc8e/server/utils/agentFlows/executors/llm-instruction.js#L36 The `completion` object don't have the `result` member, it have 'textResponse' And I add this code before return ,it works fine. ``` if (completion["textResponse"]){ completion["result"] =completion.textResponse; } ``` But I don't know if it is correct. please check. ### Are there known steps to reproduce? AnythingLLM Desktop APP , v1.9.0. Create a Agentflow , just like this: ``` { "type": "start", "config": { "variables": [ { "name": "keywords", "value": "" }, { "name": "ResponseText", "value": "1" } ] } }, { "type": "llmInstruction", "config": { "instruction": "This var will be replaced with 1 , ${ResponseText}", "resultVariable": "ResponseText", "directOutput": NULL }, { "type": "llmInstruction", "config": { "instruction": "This var will not be replaced ${ResponseText}", "resultVariable": "", "directOutput": true } } ``` The second instruction use the `resultVariable` from the first one ,will not be replaced .
yindo added the possible buginvestigating labels 2026-02-22 18:31:59 -05:00
yindo closed this issue 2026-02-22 18:31:59 -05:00
Author
Owner

@goodnessnwajichukwu commented on GitHub (Nov 16, 2025):

Hi! I reviewed AnythingLLM and it’s a strong project. The installation and onboarding docs seemed sparse — especially for non-technical users.
If needed, I can help create clearer setup instructions and feature explanations. Would you like a short improvement sample?

@goodnessnwajichukwu commented on GitHub (Nov 16, 2025): Hi! I reviewed AnythingLLM and it’s a strong project. The installation and onboarding docs seemed sparse — especially for non-technical users. If needed, I can help create clearer setup instructions and feature explanations. Would you like a short improvement sample?
yindo changed title from [BUG]: The resultVariable be removed after executeLLMInstruction. to [GH-ISSUE #4652] [BUG]: The resultVariable be removed after executeLLMInstruction. 2026-06-05 14:49:29 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2952