This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| LangGraph Solution for "Inconsistent history when using tool that returns Command with goto=E | |
| and graph=Command.PARENT" | |
| This script provides a LangGraph solution for scenarios where fine-grained control over | |
| agent state and message history is required, particularly to prevent agents from | |
| unintentionally summarizing tool outputs. | |
| Problem Addressed: | |
| The original problem (linked below) highlighted issues with LangGraph's message history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def train_SASR( | |
| D_train, # Dataset of (question x, chain-of-thought e, answer y) tuples | |
| W, # Number of warm-up (pure SFT) steps | |
| T, # Number of adaptive (SFT+GRPO) steps | |
| policy, # Initial policy π^(0)_θ (e.g., a pretrained LLM) | |
| G, # Group size for GRPO (number of sampled chains per prompt) | |
| gamma # Hyperparameter γ used in computing p_t | |
| ): | |
| """ | |
| Returns: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder