google-gemini / google-gemini/gemini-fullstack-langgraph-quickstart

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

Open
#141 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
18.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

### 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.