From e5ea4f51c7caf703c689d2ae8b4cec4473fb9d73 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Thu, 12 Dec 2024 08:10:43 -0800 Subject: [PATCH] sdk-py: Strip out unused keys in command parameter --- libs/sdk-py/langgraph_sdk/client.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libs/sdk-py/langgraph_sdk/client.py b/libs/sdk-py/langgraph_sdk/client.py index 3436188c7..67f618edd 100644 --- a/libs/sdk-py/langgraph_sdk/client.py +++ b/libs/sdk-py/langgraph_sdk/client.py @@ -1318,7 +1318,9 @@ def stream( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "config": config, "metadata": metadata, "stream_mode": stream_mode, @@ -1503,7 +1505,9 @@ async def create( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "stream_mode": stream_mode, "stream_subgraphs": stream_subgraphs, "config": config, @@ -1672,7 +1676,9 @@ async def wait( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "config": config, "metadata": metadata, "assistant_id": assistant_id, @@ -3477,7 +3483,9 @@ def stream( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "config": config, "metadata": metadata, "stream_mode": stream_mode, @@ -3662,7 +3670,9 @@ def create( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "stream_mode": stream_mode, "stream_subgraphs": stream_subgraphs, "config": config, @@ -3828,7 +3838,9 @@ def wait( """ # noqa: E501 payload = { "input": input, - "command": command, + "command": {k: v for k, v in command.items() if v is not None} + if command + else None, "config": config, "metadata": metadata, "assistant_id": assistant_id,