forked from phoenix/litellm-mirror
return traces in bedrock guardrails when enabled
This commit is contained in:
parent
89ba7b3e11
commit
9851fa7b1b
1 changed files with 8 additions and 0 deletions
|
@ -10226,6 +10226,14 @@ class CustomStreamWrapper:
|
||||||
return
|
return
|
||||||
elif self.received_finish_reason is not None:
|
elif self.received_finish_reason is not None:
|
||||||
if self.sent_last_chunk is True:
|
if self.sent_last_chunk is True:
|
||||||
|
# Bedrock returns the guardrail trace in the last chunk - we want to return this here
|
||||||
|
if (
|
||||||
|
self.custom_llm_provider == "bedrock"
|
||||||
|
and "trace" in model_response
|
||||||
|
):
|
||||||
|
return model_response
|
||||||
|
|
||||||
|
# Default - return StopIteration
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
# flush any remaining holding chunk
|
# flush any remaining holding chunk
|
||||||
if len(self.holding_chunk) > 0:
|
if len(self.holding_chunk) > 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue