gen_ai_hub.proxy.core.proxy_clients
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/proxy/core/proxy_clients.py

 
Modules
       
inspect
os
threading
uuid

 
Classes
       
builtins.object
ProxyClients

 
class ProxyClients(builtins.object)
    ProxyClients() -> 'None'
 

 
  Methods defined here:
__init__(self) -> 'None'
Initialize self.  See help(type(self)) for accurate signature.
get_proxy_cls(self, proxy_version: 'str | None' = None) -> 'type[BaseProxyClient]'
Get the proxy client class for the given version.
 
Args:
    proxy_version (str | None): The proxy version.
 
Returns:
    type[BaseProxyClient]: The proxy client class.
get_proxy_cls_name(self, proxy_client_cls: 'type[BaseProxyClient] | BaseProxyClient') -> 'str'
Get the name of the proxy client class.
 
Args:
    proxy_client_cls (type[BaseProxyClient] | BaseProxyClient): The proxy client class or instance.
 
Returns:
    str: The name of the proxy client class.
 
Raises:
    ValueError: If the provided class is not a subclass of BaseProxyClient.
    KeyError: If the class is not registered.
register(self, name: 'str')
Decorator to register a proxy client class.
 
Args:
    name (str): The name to register the proxy client class under.
 
Returns:
    Callable: A wrapper function.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
get_proxy_client(proxy_version: 'str | None' = None, catalog: 'Optional[ProxyClients]' = None, **kwargs) -> 'BaseProxyClient'
Get a proxy client for the given proxy version.
 
Args:
    proxy_version (str | None): The version of the proxy client to retrieve. If not provided, the function will
                              attempt to retrieve the version using the `get_proxy_version` function.
    catalog (ProxyClients, optional): The catalog from which to retrieve the proxy client.
                                    If not provided, the function will default to the `proxy_clients` catalog.
    **kwargs: Arbitrary keyword arguments that will be passed to the constructor of the proxy client class.
 
Returns:
    BaseProxyClient: An instance of the proxy client.
get_proxy_version(catalog: 'Optional[ProxyClients]' = None) -> 'str'
Get the current proxy version.
The version is selected in the following order:
- thread-local overwrite (set with proxy_version_context)
- global overwrite (set with set_proxy_version)
- environment variable (LLM_PROXY_VERSION)
- first registered proxy version
 
Args:
    catalog (Optional[ProxyClients]): An instance of the ProxyClients class. Defaults to None,
                                   in which case the global proxy_clients object is used.
 
Returns:
    str: The current proxy version.
proxy_version_context(proxy_version: 'str', catalog: 'Optional[ProxyClients]' = None) -> 'None'
Context manager to set a thread-local proxy version.
 
Args:
    proxy_version (str): The proxy version to set.
    catalog (Optional[ProxyClients]): The catalog for which the proxy version is to be set. If none is provided,
                                  the proxy version is set for the default proxy_clients catalog.
 
Raises:
    ValueError: If proxy_version is not a string.
set_proxy_version(proxy_version: 'str', catalog: 'Optional[ProxyClients]' = None) -> 'None'
Set the global proxy version.
 
Args:
    proxy_version (str): The proxy version to set.
    catalog (Optional[ProxyClients]): The catalog for which the proxy version is to be set. If none is provided,
                                  the proxy version is set for the default proxy_clients catalog.
 
Raises:
    ValueError: If proxy_version is not a string.

 
Data
        Optional = typing.Optional
PROXY_VERSION_ENV_VARIABLE = 'LLM_PROXY_VERSION'
THREAD_PROXY_VERSION_OVERWRITE = 'proxy_version_overwrite'
annotations = _Feature((3, 7, 0, 'beta', 1), (3, 11, 0, 'alpha', 0), 16777216)
no_value = <object object>
proxy_clients = <gen_ai_hub.proxy.core.proxy_clients.ProxyClients object>