Skip to content

Commit 87b7912

Browse files
fix: omit empty thought text for root workflow function
Signed-off-by: Patrick Chin <8509935+thepatrickchin@users.noreply.github.com>
1 parent b30a2fe commit 87b7912

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

packages/nvidia_nat_core/src/nat/front_ends/fastapi/step_adaptor.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,16 @@ def _handle_function(self, step: IntermediateStepPayload, ancestry: InvocationNo
250250
```
251251
""").strip("\n").format(input_value=escaped_input, format_input_type=format_input_type)
252252

253+
# Omit thought_text for top-level workflow function (parent is root)
254+
thought_text = None
255+
if ancestry.parent_id != "root":
256+
thought_text = self._get_thought_description(step.metadata, f"Running function: {step.name}", "...")
257+
253258
event = ResponseIntermediateStep(id=step.UUID,
254259
name=f"Function Start: {step.name}",
255260
payload=payload_str,
256261
parent_id=ancestry.parent_id,
257-
thought_text=self._get_thought_description(
258-
step.metadata, f"Running function: {step.name}", "..."))
262+
thought_text=thought_text)
259263
return event
260264

261265
if step.event_type == IntermediateStepType.FUNCTION_END:
@@ -305,14 +309,18 @@ def _handle_function(self, step: IntermediateStepPayload, ancestry: InvocationNo
305309
output_value=escaped_output,
306310
format_output_type=format_output_type)
307311

312+
# Omit thought_text for top-level workflow function (parent is root)
313+
thought_text = None
314+
if ancestry.parent_id != "root":
315+
thought_text = self._get_thought_description(start_step.metadata if start_step else None,
316+
f"Running function: {step.name}",
317+
"... completed")
318+
308319
event = ResponseIntermediateStep(id=step.UUID,
309320
name=f"Function Complete: {step.name}",
310321
payload=payload_str,
311322
parent_id=ancestry.parent_id,
312-
thought_text=self._get_thought_description(
313-
start_step.metadata if start_step else None,
314-
f"Running function: {step.name}",
315-
"... completed"))
323+
thought_text=thought_text)
316324
return event
317325

318326
return None

0 commit comments

Comments
 (0)