Skip to content

Commit

Permalink
delete unused retry decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Feb 13, 2024
1 parent c4b23db commit 6f0e783
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions libs/community/langchain_community/utils/google.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
"""Utilities to use Google provided components."""

from importlib import metadata
from typing import Any, Callable, Optional, Union

from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models.llms import create_base_retry_decorator


def create_retry_decorator(
*,
max_retries: int = 1,
run_manager: Optional[
Union[AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun]
] = None,
) -> Callable[[Any], Any]:
"""Creates a retry decorator for Vertex / Palm LLMs."""
from google.api_core.exceptions import (
Aborted,
DeadlineExceeded,
GoogleAPIError,
ResourceExhausted,
ServiceUnavailable,
)

errors = [
ResourceExhausted,
ServiceUnavailable,
Aborted,
DeadlineExceeded,
GoogleAPIError,
]
decorator = create_base_retry_decorator(
error_types=errors, max_retries=max_retries, run_manager=run_manager
)
return decorator
from typing import Any, Optional


def get_client_info(module: Optional[str] = None) -> Any:
Expand Down

0 comments on commit 6f0e783

Please sign in to comment.