mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-30 23:02:50 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user