Skip to content

Commit

Permalink
vertexai[patch]: use default astream for gemini models (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Oct 1, 2024
2 parents c03162e + e362a16 commit 39fd967
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/vertexai/langchain_google_vertexai/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,8 +1593,13 @@ async def _astream(
run_manager: Optional[AsyncCallbackManagerForLLMRun] = None,
**kwargs: Any,
) -> AsyncIterator[ChatGenerationChunk]:
# TODO: Update to properly support async streaming from gemini.
if not self._is_gemini_model:
raise NotImplementedError()
async for chunk in super()._astream(
messages, stop=stop, run_manager=run_manager, **kwargs
):
yield chunk
return
request = self._prepare_request_gemini(messages=messages, stop=stop, **kwargs)

response_iter = _acompletion_with_retry(
Expand Down

0 comments on commit 39fd967

Please sign in to comment.