mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-21 07:55:08 +00:00
fix(runtime): reject empty native Anthropic streams
Signed-off-by: Alex Fournier <afournier@nvidia.com>
This commit is contained in:
parent
044b88eb69
commit
80ef455027
1 changed files with 9 additions and 0 deletions
|
|
@ -3282,6 +3282,15 @@ def interruptible_streaming_api_call(agent, api_kwargs: dict, *, on_first_delta=
|
|||
|
||||
if agent._interrupt_requested:
|
||||
return None
|
||||
if (
|
||||
base_final_message is not None
|
||||
and not getattr(base_final_message, "content", None)
|
||||
and getattr(base_final_message, "stop_reason", None) is None
|
||||
):
|
||||
raise EmptyStreamError(
|
||||
"Provider returned an empty stream with no stop_reason "
|
||||
"(possible upstream error or malformed event stream)."
|
||||
)
|
||||
if base_final_message is not None and not stream.output_modified:
|
||||
return base_final_message
|
||||
final_message = accumulator.response(base_final_message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue