Skip to content

Commit

Permalink
Merge pull request #37 from ai-forever/fix/remove_logging
Browse files Browse the repository at this point in the history
fix: remove useless warning about tokens
  • Loading branch information
Rai220 authored Nov 2, 2024
2 parents f6642e5 + 1f4b6ad commit 7504bf9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ cython_debug/
.ruff_cache/

.vscode/
.aider*
12 changes: 6 additions & 6 deletions src/gigachat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _update_token(self) -> None:
credentials=self._settings.credentials,
scope=self._settings.scope,
)
_logger.info("OAUTH UPDATE TOKEN")
_logger.debug("OAUTH UPDATE TOKEN")
elif self._settings.user and self._settings.password:
self._access_token = _build_access_token(
post_token.sync(
Expand All @@ -232,7 +232,7 @@ def _decorator(self, call: Callable[..., T]) -> T:
try:
return call()
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self._reset_token()
self._update_token()
return call()
Expand Down Expand Up @@ -289,7 +289,7 @@ def stream(self, payload: Union[Chat, Dict[str, Any], str]) -> Iterator[ChatComp
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self._reset_token()
self._update_token()

Expand Down Expand Up @@ -333,7 +333,7 @@ async def _aupdate_token(self) -> None:
credentials=self._settings.credentials,
scope=self._settings.scope,
)
_logger.info("OAUTH UPDATE TOKEN")
_logger.debug("OAUTH UPDATE TOKEN")
elif self._settings.user and self._settings.password:
self._access_token = _build_access_token(
await post_token.asyncio(
Expand All @@ -350,7 +350,7 @@ async def _adecorator(self, acall: Callable[..., Awaitable[T]]) -> T:
try:
return await acall()
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self._reset_token()
await self._aupdate_token()
return await acall()
Expand Down Expand Up @@ -429,7 +429,7 @@ async def astream(self, payload: Union[Chat, Dict[str, Any], str]) -> AsyncItera
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self._reset_token()
await self._aupdate_token()

Expand Down
8 changes: 4 additions & 4 deletions src/gigachat/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def run_messages_stream(
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self.base_client._reset_token()
self.base_client._update_token()

Expand Down Expand Up @@ -271,7 +271,7 @@ def rerun_messages_stream(
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self.base_client._reset_token()
self.base_client._update_token()

Expand Down Expand Up @@ -479,7 +479,7 @@ async def run_messages_stream(
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self.base_client._reset_token()
await self.base_client._aupdate_token()

Expand Down Expand Up @@ -518,7 +518,7 @@ async def rerun_messages_stream(
yield chunk
return
except AuthenticationError:
_logger.warning("AUTHENTICATION ERROR")
_logger.debug("AUTHENTICATION ERROR")
self.base_client._reset_token()
await self.base_client._aupdate_token()

Expand Down

0 comments on commit 7504bf9

Please sign in to comment.