Skip to content

Conversation

@heliamoh
Copy link
Collaborator

  • Add a reusable preprocessing graph that rephrases the user query, runs the safety checker, and carries forward structured results.
  • Refine the safety checker prompt to return explicit safety and reason_unsafe fields.
  • Update BaseGraphBuilder and ReactToMeGraphBuilder to gate RAG vs. refusal based on safety, with a new unsafe-answer generator.

@heliamoh heliamoh marked this pull request as ready for review November 10, 2025 16:53
@heliamoh heliamoh requested a review from GFJHogue November 10, 2025 16:53
return BaseState(
additional_content=AdditionalContent(search_results=search_results)
**state,
additional_content=AdditionalContent(search_results=search_results),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does adding **state in spots like this solve some issue with updating the state?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BaseState(**state, …) merge isn’t there to work around a bug—it’s there because LangGraph hands us an evolving state dict, and we don’t want to drop any of the fields that preprocessing or earlier nodes already wrote (rephrased input, safety tag, chat history, etc.). Postprocess only needs to add additional_content, so merging **state with the new field preserves the existing state while layering on the search results. If we just returned BaseState(additional_content=...), we’d lose everything else that was already in the state and downstream nodes would break.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LangGraph implicitly updates the state using the returned dict without dropping omitted fields, so we shouldn't need to do this.

@GFJHogue
Copy link
Collaborator

moving to #100

@GFJHogue GFJHogue closed this Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants