Support post-call guards for stream and non-stream responses

This commit is contained in:
Tomer Bin 2025-01-26 12:28:22 +02:00
parent be35c9a663
commit 4a31b32a88
8 changed files with 297 additions and 33 deletions

View file

@ -3947,7 +3947,7 @@ def _count_characters(text: str) -> int:
return len(filtered_text)
def get_response_string(response_obj: ModelResponse) -> str:
def get_response_string(response_obj: Union[ModelResponse, ModelResponseStream]) -> str:
_choices: List[Union[Choices, StreamingChoices]] = response_obj.choices
response_str = ""