refactor: route Gemini async paths through _get_async_client

`_ahandle_completion` and `_ahandle_streaming_completion` were calling
`_get_sync_client()` directly. The other native providers (OpenAI,
Anthropic, Azure) consistently route async code through
`_get_async_client()`; matching that abstraction here keeps the
contract consistent and lets a future async-specific override work
without re-touching call sites.
This commit is contained in:
Greyson LaLonde
2026-04-12 05:08:32 +08:00
parent 41403c09b4
commit 1dc310844c

View File

@@ -1216,7 +1216,7 @@ class GeminiCompletion(BaseLLM):
try:
# The API accepts list[Content] but mypy is overly strict about variance
contents_for_api: Any = contents
response = await self._get_sync_client().aio.models.generate_content(
response = await self._get_async_client().aio.models.generate_content(
model=self.model,
contents=contents_for_api,
config=config,
@@ -1257,7 +1257,7 @@ class GeminiCompletion(BaseLLM):
# The API accepts list[Content] but mypy is overly strict about variance
contents_for_api: Any = contents
stream = await self._get_sync_client().aio.models.generate_content_stream(
stream = await self._get_async_client().aio.models.generate_content_stream(
model=self.model,
contents=contents_for_api,
config=config,