mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(realtime): resolve the vertex token resolver at call time
Binding the bound method at import froze the module-level VertexBase instance, so callers that swap it no longer reached their replacement.
This commit is contained in:
parent
58844d3bda
commit
d643136895
1 changed files with 13 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import asyncio
|
||||
import os
|
||||
from typing import Any, Final, cast
|
||||
from typing import Any, Final, Literal, cast
|
||||
|
||||
import litellm
|
||||
from litellm.constants import (
|
||||
|
|
@ -43,7 +43,6 @@ openai_realtime: Final = OpenAIRealtime()
|
|||
bedrock_realtime: Final = BedrockRealtime()
|
||||
xai_realtime: Final = XAIRealtime()
|
||||
vertex_llm_base: Final = VertexBase()
|
||||
vertex_access_token_resolver: Final[VertexAccessTokenResolver] = vertex_llm_base._ensure_access_token_async
|
||||
base_llm_http_handler = BaseLLMHTTPHandler()
|
||||
|
||||
|
||||
|
|
@ -288,6 +287,18 @@ async def arealtime_calls(
|
|||
)
|
||||
|
||||
|
||||
async def vertex_access_token_resolver(
|
||||
credentials: VERTEX_CREDENTIALS_TYPES | None,
|
||||
project_id: str | None,
|
||||
custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"],
|
||||
) -> tuple[str, str]:
|
||||
return await vertex_llm_base._ensure_access_token_async(
|
||||
credentials=credentials,
|
||||
project_id=project_id,
|
||||
custom_llm_provider=custom_llm_provider,
|
||||
)
|
||||
|
||||
|
||||
async def _resolve_vertex_access_token_bounded(
|
||||
credentials: VERTEX_CREDENTIALS_TYPES | None,
|
||||
project_id: str | None,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue