Skip to content

Commit 27b82c1

Browse files
authored
Merge pull request #91 from UiPath/fix/lint_pretty
fix: linting pretty print
2 parents 5d23f46 + cf25812 commit 27b82c1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/uipath_langchain/_cli/_runtime/_runtime.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22
import logging
33
import os
4-
from typing import List, Optional
4+
from typing import Any, Dict, List, Optional, Tuple, Union
55

66
from langchain_core.callbacks.base import BaseCallbackHandler
77
from langchain_core.messages import BaseMessage
@@ -315,14 +315,14 @@ def _extract_graph_result(self, final_chunk, graph: CompiledStateGraph):
315315
# Fallback for any other case
316316
return final_chunk
317317

318-
def _pretty_print(self, stream_chunk: tuple):
318+
def _pretty_print(self, stream_chunk: Union[Tuple[Any, Any], Dict[str, Any], Any]):
319319
"""
320320
Pretty print a chunk from a LangGraph stream with stream_mode="updates" and subgraphs=True.
321321
322322
Args:
323323
stream_chunk: A tuple of (namespace, updates) from graph.astream()
324324
"""
325-
if not stream_chunk or len(stream_chunk) < 2:
325+
if not isinstance(stream_chunk, tuple) or len(stream_chunk) < 2:
326326
return
327327

328328
node_namespace = ""
@@ -355,7 +355,7 @@ def _pretty_print(self, stream_chunk: tuple):
355355
if isinstance(messages, list):
356356
for message in messages:
357357
if isinstance(message, BaseMessage):
358-
logger.info("%s", message.pretty_print())
358+
message.pretty_print()
359359

360360
# Exclude "messages" from node_result and pretty-print the rest
361361
metadata = {k: v for k, v in node_result.items() if k != "messages"}

0 commit comments

Comments
 (0)