to_langgraph_state#

scikitplot.corpus.to_langgraph_state(documents, *, query='', match_mode='')[source]#

Convert documents to a LangGraph-compatible state dict.

Parameters:
documentsSequence[CorpusDocument]

Source documents.

querystr, optional

The original query text (for context in graph state).

match_modestr, optional

The match mode used (e.g., "hybrid").

Returns:
dict[str, Any]

State dict with keys "documents", "query", "match_mode", "n_results". "documents" is a list of LangChain-compatible dicts.

Parameters:
Return type:

dict[str, Any]

Notes

User note: Use as input to a LangGraph node:

state = to_langgraph_state(results, query="...")
graph.invoke(state)