Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk-py: Add Sequence[dict] type to values param type for update_state() #2054

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/sdk-py/langgraph_sdk/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""The LangGraph client implementations connect to the LangGraph API.

Check notice on line 1 in libs/sdk-py/langgraph_sdk/client.py

View workflow job for this annotation

GitHub Actions / benchmark

Benchmark results

......................................... fanout_to_subgraph_10x: Mean +- std dev: 49.8 ms +- 1.0 ms ......................................... fanout_to_subgraph_10x_sync: Mean +- std dev: 45.0 ms +- 0.8 ms ......................................... fanout_to_subgraph_10x_checkpoint: Mean +- std dev: 70.4 ms +- 1.8 ms ......................................... fanout_to_subgraph_10x_checkpoint_sync: Mean +- std dev: 73.8 ms +- 0.9 ms ......................................... fanout_to_subgraph_100x: Mean +- std dev: 500 ms +- 20 ms ......................................... fanout_to_subgraph_100x_sync: Mean +- std dev: 432 ms +- 7 ms ......................................... fanout_to_subgraph_100x_checkpoint: Mean +- std dev: 733 ms +- 43 ms ......................................... fanout_to_subgraph_100x_checkpoint_sync: Mean +- std dev: 727 ms +- 12 ms ......................................... react_agent_10x: Mean +- std dev: 28.5 ms +- 0.7 ms ......................................... react_agent_10x_sync: Mean +- std dev: 20.5 ms +- 0.1 ms ......................................... react_agent_10x_checkpoint: Mean +- std dev: 44.7 ms +- 3.9 ms ......................................... react_agent_10x_checkpoint_sync: Mean +- std dev: 34.8 ms +- 3.4 ms ......................................... react_agent_100x: Mean +- std dev: 314 ms +- 7 ms ......................................... react_agent_100x_sync: Mean +- std dev: 246 ms +- 2 ms ......................................... react_agent_100x_checkpoint: Mean +- std dev: 832 ms +- 20 ms ......................................... react_agent_100x_checkpoint_sync: Mean +- std dev: 744 ms +- 14 ms ......................................... wide_state_25x300: Mean +- std dev: 18.7 ms +- 0.4 ms ......................................... wide_state_25x300_sync: Mean +- std dev: 11.1 ms +- 0.1 ms ......................................... wide_state_25x300_checkpoint: Mean +- std dev: 237 ms +- 9 ms ......................................... wide_state_25x300_checkpoint_sync: Mean +- std dev: 239 ms +- 16 ms ......................................... wide_state_15x600: Mean +- std dev: 21.7 ms +- 0.5 ms ......................................... wide_state_15x600_sync: Mean +- std dev: 12.9 ms +- 0.2 ms ......................................... wide_state_15x600_checkpoint: Mean +- std dev: 417 ms +- 12 ms ......................................... wide_state_15x600_checkpoint_sync: Mean +- std dev: 418 ms +- 17 ms ......................................... wide_state_9x1200: Mean +- std dev: 22.0 ms +- 0.5 ms ......................................... wide_state_9x1200_sync: Mean +- std dev: 12.9 ms +- 0.1 ms ......................................... wide_state_9x1200_checkpoint: Mean +- std dev: 266 ms +- 8 ms ......................................... wide_state_9x1200_checkpoint_sync: Mean +- std dev: 266 ms +- 17 ms

Check notice on line 1 in libs/sdk-py/langgraph_sdk/client.py

View workflow job for this annotation

GitHub Actions / benchmark

Comparison against main

+-----------------------------------------+---------+-----------------------+ | Benchmark | main | changes | +=========================================+=========+=======================+ | fanout_to_subgraph_10x | 51.4 ms | 49.8 ms: 1.03x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_sync | 20.7 ms | 20.5 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600_sync | 13.1 ms | 12.9 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_sync | 11.2 ms | 11.1 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600 | 21.9 ms | 21.7 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_checkpoint_sync | 750 ms | 744 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_100x | 316 ms | 314 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_sync | 247 ms | 246 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_checkpoint_sync | 74.2 ms | 73.8 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_checkpoint | 837 ms | 832 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200_sync | 13.0 ms | 12.9 ms: 1.00x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200 | 21.9 ms | 22.0 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_checkpoint_sync | 715 ms | 727 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x | 488 ms | 500 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_checkpoint | 708 ms | 733 ms: 1.04x slower | +-----------------------------------------+---------+-----------------------+ | Geometric mean | (ref) | 1.00x faster | +-----------------------------------------+---------+-----------------------+ Benchmark hidden because not significant (13): wide_state_9x1200_checkpoint_sync, wide_state_25x300_checkpoint, wide_state_25x300, wide_state_9x1200_checkpoint, react_agent_10x, wide_state_15x600_checkpoint, react_agent_10x_checkpoint, wide_state_25x300_checkpoint_sync, react_agent_10x_checkpoint_sync, wide_state_15x600_checkpoint_sync, fanout_to_subgraph_100x_sync, fanout_to_subgraph_10x_sync, fanout_to_subgraph_10x_checkpoint

This module provides both asynchronous (LangGraphClient) and synchronous (SyncLanggraphClient)
clients to interacting with the LangGraph API's core resources such as
Expand Down Expand Up @@ -1056,7 +1056,7 @@
async def update_state(
self,
thread_id: str,
values: dict,
values: Optional[Union[dict, Sequence[dict]]],
*,
as_node: Optional[str] = None,
checkpoint: Optional[Checkpoint] = None,
Expand Down Expand Up @@ -3117,7 +3117,7 @@
def update_state(
self,
thread_id: str,
values: dict,
values: Optional[Union[dict, Sequence[dict]]],
*,
as_node: Optional[str] = None,
checkpoint: Optional[Checkpoint] = None,
Expand Down
Loading