diff --git a/trustgraph-base/trustgraph/base/prompt_client.py b/trustgraph-base/trustgraph/base/prompt_client.py index 370cf78a..74b25132 100644 --- a/trustgraph-base/trustgraph/base/prompt_client.py +++ b/trustgraph-base/trustgraph/base/prompt_client.py @@ -51,7 +51,8 @@ class PromptClient(RequestResponse): end_stream = getattr(resp, 'end_of_stream', False) - if resp.text: + # Always call callback if there's text OR if it's the final message + if resp.text is not None: last_text = resp.text # Call chunk callback if provided with both chunk and end_of_stream flag if chunk_callback: