From 87603d8a00e73b4637273cf80c388772e99b4688 Mon Sep 17 00:00:00 2001 From: Yassin Nouh <70436855+YassinNouh21@users.noreply.github.com> Date: Wed, 26 Mar 2025 19:48:54 +0200 Subject: [PATCH] docs: add version admonitions for `Interrupt` and `RetryPolicy` (#3988) This pull request includes changes to add version admonitions to the documentation and update the styling for these admonitions. The most important changes include the addition of version information to the documentation, updates to the CSS for version admonitions, and modifications to the `mkdocs.yml` configuration file to include the new stylesheets. this should solve this #3991 --------- Co-authored-by: Eugene Yurtsev --- docs/docs/stylesheets/version_admonitions.css | 38 +++++++++++++++++++ docs/mkdocs.yml | 2 + libs/langgraph/langgraph/types.py | 16 +++++++- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 docs/docs/stylesheets/version_admonitions.css diff --git a/docs/docs/stylesheets/version_admonitions.css b/docs/docs/stylesheets/version_admonitions.css new file mode 100644 index 000000000..a8fcb6429 --- /dev/null +++ b/docs/docs/stylesheets/version_admonitions.css @@ -0,0 +1,38 @@ +:root { + --md-admonition-icon--version-added: url('data:image/svg+xml;charset=utf-8,'); + --md-admonition-icon--version-changed: url('data:image/svg+xml;charset=utf-8,'); +} + +.md-typeset .admonition.version-added, +.md-typeset details.version-added { + border-color: rgb(0, 191, 165); +} + +.md-typeset .version-added > .admonition-title, +.md-typeset .version-added > summary { + background-color: rgba(0, 191, 165, 0.1); +} + +.md-typeset .version-added > .admonition-title::before, +.md-typeset .version-added > summary::before { + background-color: rgb(0, 191, 165); + -webkit-mask-image: var(--md-admonition-icon--version-added); + mask-image: var(--md-admonition-icon--version-added); +} + +.md-typeset .admonition.version-changed, +.md-typeset details.version-changed { + border-color: rgb(100, 221, 23); +} + +.md-typeset .version-changed > .admonition-title, +.md-typeset .version-changed > summary { + background-color: rgba(100, 221, 23, 0.1); +} + +.md-typeset .version-changed > .admonition-title::before, +.md-typeset .version-changed > summary::before { + background-color: rgb(100, 221, 23); + -webkit-mask-image: var(--md-admonition-icon--version-changed); + mask-image: var(--md-admonition-icon--version-changed); +} \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 697d6bdc4..049a6a4ab 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -503,3 +503,5 @@ validation: not_found: info copyright: > Copyright © 2025 LangChain, Inc | Consent Preferences +extra_css: + - stylesheets/version_admonitions.css diff --git a/libs/langgraph/langgraph/types.py b/libs/langgraph/langgraph/types.py index 0a3e9f205..6fb0b9b4a 100644 --- a/libs/langgraph/langgraph/types.py +++ b/libs/langgraph/langgraph/types.py @@ -101,7 +101,10 @@ def default_retry_on(exc: Exception) -> bool: class RetryPolicy(NamedTuple): - """Configuration for retrying nodes.""" + """Configuration for retrying nodes. + + !!! version-added "Added in version 0.2.24." + """ initial_interval: float = 0.5 """Amount of time that must elapse before the first retry occurs. In seconds.""" @@ -120,13 +123,20 @@ class RetryPolicy(NamedTuple): class CachePolicy(NamedTuple): - """Configuration for caching nodes.""" + """Configuration for caching nodes. + + !!! version-added "Added in version 0.2.24." + """ pass @dataclasses.dataclass(**_DC_KWARGS) class Interrupt: + """ + !!! version-added "Added in version 0.2.24." + """ + value: Any resumable: bool = False ns: Optional[Sequence[str]] = None @@ -268,6 +278,8 @@ N = TypeVar("N", bound=Hashable) class Command(Generic[N], ToolOutputMixin): """One or more commands to update the graph's state and send messages to nodes. + !!! version-added "Added in version 0.2.24." + Args: graph: graph to send the command to. Supported values are: