File size: 917 Bytes
7ff7119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""RAGState — internal state of the rag_query_subgraph (used by the chat search_documents tool).

Cleanly isolated from the parent ChatState because the RAG retrieval is a
self-contained subsystem. The subgraph can be invoked via its own compile
(which makes the LangSmith trace cleaner).
"""

from __future__ import annotations

from typing import TypedDict


class RAGState(TypedDict, total=False):
    """The rag_query_subgraph state."""

    query: str
    """The user's question (or a search phrase generated by the chat agent)."""

    top_k: int
    """Maximum number of returned hits. Default: 5."""

    raw_hits: list[dict]
    """Raw output of hybrid_search (vector + BM25 RRF combined)."""

    reranked_hits: list[dict]
    """Output of the rerank node (in the baseline this is the same as raw_hits)."""

    output: str
    """Output of the format node: human-readable, with [Source: X] citations."""