Skip to content

Commit

Permalink
updated Authrefresher class with async refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshp19 committed Nov 17, 2024
1 parent 0312bbf commit 823596a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ class AuthTokenRefresher(openai.AsyncClient):
def __init__(self, **kwargs: Any) -> None:
super().__init__(api_key="DUMMY", **kwargs)
self.refresh_threshold = 600 # 10 minutes
self.creds = None
self.project = None
self.creds, self.project = default_async(
scopes=["https://www.googleapis.com/auth/cloud-platform"]
)
Expand Down Expand Up @@ -621,6 +619,9 @@ def __init__(
self._tool_index: int | None = None

async def _main_task(self) -> None:
if hasattr(self._llm._client, "_refresh_credentials"):
logger.info("Refreshing google auth credentials")
await self._llm._client._refresh_credentials()
if not self._oai_stream:
self._oai_stream = await self._awaitable_oai_stream

Expand Down

0 comments on commit 823596a

Please sign in to comment.