Skip to content

KeyError: "Input to PromptTemplate is missing variables {'content'}" in generate_answer_node_k_level #995

Open
@andrei-ace

Description

@andrei-ace

Describe the bug
generate_answer_node_k_level still injects the variable context into the PromptTemplate, but the template now expects content.
This mismatch surfaces as soon as the node executes inside any graph (e.g. DepthSearchGraph) and triggers the following exception:
KeyError: "Input to PromptTemplate is missing variables {'content'}. Expected: ['content', 'format_instructions'] Received: ['format_instructions']"

To Reproduce
Steps to reproduce the behavior:

  1. Install latest version of scrapegraphai (1.59.0)
  2. Use DepthSearchGraph with "depth": 2

Expected behavior
The node should supply content, not context, so that the PromptTemplate receives all required variables and the graph runs without error.

"context": chunk.get("document"),

input_variables=["context", "question"],

answer = merge_chain.invoke({"context": batch_results, "question": user_prompt})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions