mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-24 00:22:25 +02:00
refactor(langgraph): simplify Send sanitization with dict comprehension
Co-authored-by: sydney-runkle <54324534+sydney-runkle@users.noreply.github.com>
This commit is contained in:
co-authored by
sydney-runkle
parent
57f0e846e8
commit
91f6fea068
@@ -1121,14 +1121,10 @@ def sanitize_untracked_values_in_send(
|
||||
# Command
|
||||
return packet
|
||||
|
||||
sanitized_arg = dict(packet.arg)
|
||||
|
||||
# top level keys should be the channel names
|
||||
to_pop = set()
|
||||
for k, v in sanitized_arg.items():
|
||||
if isinstance(channels.get(k), UntrackedValue):
|
||||
to_pop.add(k)
|
||||
for k in to_pop:
|
||||
sanitized_arg.pop(k)
|
||||
sanitized_arg = {
|
||||
k: v
|
||||
for k, v in packet.arg.items()
|
||||
if not isinstance(channels.get(k), UntrackedValue)
|
||||
}
|
||||
|
||||
return Send(node=packet.node, arg=sanitized_arg)
|
||||
|
||||
Reference in New Issue
Block a user