fix ModelResponseIterator

This commit is contained in:
Ishaan Jaff 2024-11-14 10:53:37 -08:00
parent c3a2c77b55
commit a866bdb01e
2 changed files with 6 additions and 1 deletions

View file

@ -644,7 +644,9 @@ class AnthropicChatCompletion(BaseLLM):
class ModelResponseIterator:
def __init__(self, streaming_response, sync_stream: bool, json_mode: bool):
def __init__(
self, streaming_response, sync_stream: bool, json_mode: Optional[bool] = False
):
self.streaming_response = streaming_response
self.response_iterator = self.streaming_response
self.content_blocks: List[ContentBlockDelta] = []

View file

@ -45,6 +45,9 @@ class BaseLLMChatTest(ABC):
)
assert response is not None
# for OpenAI the content contains the JSON schema, so we need to assert that the content is not None
assert response.choices[0].message.content is not None
def test_message_with_name(self):
base_completion_call_args = self.get_base_completion_call_args()
messages = [