Skip to content

Search Query duplicated in state, leading to wrong in Number of Ran Queries #141

@hllj

Description

@hllj

Description of the bug:

I think your code has some duplication in return variable state for search_query.

  1. generate_query node returns {"search_query": result.query}, which will add to search_query in OverallState (not QueryGenerationState actually) first n results.
  2. Multiple web_search nodes return { "sources_gathered": sources_gathered, "search_query": [state["search_query"]], "web_research_result": [modified_text], } which will duplicate in OverallState.

So in the end, the number of first search_query has duplicate twice (one with no result, one with search results), which kindly affects reflection node, for number of ran queries track wrong number.

LangSmith trace: https://smith.langchain.com/public/9c27a818-4cd3-4ad0-9e33-2b87dd658d1c/

Actual vs expected behavior:

Actual result:

It duplicated and then number of ran queries track wrong.
Image

Image

Expected behavior:

We should only count for one time and fix the number of ran queries correct. This one will really need because of the later tracking.

Any other information you'd like to share?

I think the typing for QueryGenerationState here is misunderstood.
LangGraph did not have something working like different states in one workflow, query generation node will assign these queries into OverallState not QueryGenerationState.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions