mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-29 03:09:45 +02:00
Fixes https://github.com/langchain-ai/langgraph/issues/5784 * Removes usage of `is_last_step`, no longer needed with `remaining_steps` * Make `remaining_steps` `NotRequired` so that json schema doesn't suggest need for user input * Move `PregelScratchpad` to shared utils file to prevent circular import issue (it's used from `channels/managed` and other pregel files). * Ensures that managed values wrapped in `NotRequired` or `Required` are still recognized!
19 lines
407 B
Python
19 lines
407 B
Python
import dataclasses
|
|
from typing import Any, Callable
|
|
|
|
from langgraph.types import _DC_KWARGS
|
|
|
|
|
|
@dataclasses.dataclass(**_DC_KWARGS)
|
|
class PregelScratchpad:
|
|
step: int
|
|
stop: int
|
|
# call
|
|
call_counter: Callable[[], int]
|
|
# interrupt
|
|
interrupt_counter: Callable[[], int]
|
|
get_null_resume: Callable[[bool], Any]
|
|
resume: list[Any]
|
|
# subgraph
|
|
subgraph_counter: Callable[[], int]
|