Skip to content

Commit 9a78953

Browse files
committed
feat(langgraph-py): fix resolving of null/none value
1 parent ead19c7 commit 9a78953

File tree

1 file changed

+8
-0
lines changed
  • typescript-sdk/integrations/langgraph/python/ag_ui_langgraph

1 file changed

+8
-0
lines changed

typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def get_stream_payload_input(
3232
return input_payload
3333

3434
def stringify_if_needed(item: Any) -> str:
35+
if item is None:
36+
return ''
3537
if isinstance(item, str):
3638
return item
3739
return json.dumps(item)
@@ -60,6 +62,12 @@ def langchain_messages_to_agui(messages: List[BaseMessage]) -> List[AGUIMessage]
6062
)
6163
for tc in message.tool_calls
6264
]
65+
66+
print('-')
67+
print(1, message.content)
68+
print(2, resolve_message_content(message.content))
69+
print(3, stringify_if_needed(resolve_message_content(message.content)))
70+
print('-')
6371
agui_messages.append(AGUIAssistantMessage(
6472
id=str(message.id),
6573
role="assistant",

0 commit comments

Comments
 (0)