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

 
Package Contents
       
base
proxy_clients
utils

 
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
        __all__ = ('set_proxy_version', 'get_proxy_version', 'proxy_version_context', 'get_proxy_client')