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.
 
:param proxy_version: 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.
:type proxy_version: str | None, optional
:param catalog: The catalog from which to retrieve the proxy client. If not provided, the function will 
                default to the `proxy_clients` catalog
:type catalog: Optional[ProxyClients], optional
:param kwargs: Arbitrary keyword arguments that will be passed to the constructor of the proxy client class.
:type kwargs: dict
:return: An instance of the proxy client.
:rtype: BaseProxyClient
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
 
:param catalog: The catalog from which to get the proxy version. If none is provided,
:type catalog: Optional[ProxyClients], optional
:raises ValueError: If no proxy version is set.
:return: The current proxy version.
:rtype: str
proxy_version_context(proxy_version: 'str', catalog: 'Optional[ProxyClients]' = None) -> 'None'
Context manager to set a thread-local proxy version.
 
:param proxy_version: The proxy version to set.
:type proxy_version: str
:param catalog: 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.
:type catalog: Optional[ProxyClients], optional
: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.
 
:param proxy_version: The proxy version to set.
:type proxy_version: str
:param catalog: 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.
:type catalog: Optional[ProxyClients], optional
:raises ValueError: If proxy_version is not a string.

 
Data
        __all__ = ('set_proxy_version', 'get_proxy_version', 'proxy_version_context', 'get_proxy_client')