langchain
a336afae - feat(langchain): use decorators for jumps instead (#33179)

Commit
100 days ago
feat(langchain): use decorators for jumps instead (#33179) The old `before_model_jump_to` classvar approach was quite clunky, this is nicer imo and easier to document. Also moving from `jump_to` to `can_jump_to` which is more idiomatic. Before: ```py class MyMiddleware(AgentMiddleware): before_model_jump_to: ClassVar[list[JumpTo]] = ["end"] def before_model(state, runtime) -> dict[str, Any]: return {"jump_to": "end"} ``` After ```py class MyMiddleware(AgentMiddleware): @hook_config(can_jump_to=["end"]) def before_model(state, runtime) -> dict[str, Any]: return {"jump_to": "end"} ```
Author
Parents
Loading