gen_ai_hub.proxy.native.google_genai package
Submodules
gen_ai_hub.proxy.native.google_genai.clients module
- class AICoreDynamicTransport
Bases:
BaseTransportSynchronous transport that dynamically resolves deployment URLs per request.
- __init__(proxy_client, **deployment_selector_kwargs)
Transport constructor.
- Parameters:
proxy_client (BaseProxyClient) -- The proxy client used to select deployments.
- close()
Closes the inner transport.
- get_selector_kwargs()
Get the deployment selector kwargs.
- Returns:
The deployment selector kwargs.
- Return type:
dict
- handle_request(request)
Handles the request by rewriting it to route through the appropriate AI Core deployment.
- Parameters:
request (httpx.Request) -- The original HTTPX request.
- Returns:
The HTTPX response from the AI Core deployment.
- Return type:
httpx.Response
- class AsyncAICoreDynamicTransport
Bases:
AsyncBaseTransportAsynchronous transport that dynamically resolves deployment URLs per request.
- __init__(proxy_client, **deployment_selector_kwargs)
Transport constructor.
- Parameters:
proxy_client (BaseProxyClient) -- The proxy client used to select deployments.
- async aclose()
Closes the inner transport.
- get_selector_kwargs()
get the deployment selector kwargs.
- Returns:
The deployment selector kwargs.
- Return type:
dict
- async handle_async_request(request)
Handles the request by rewriting it to route through the appropriate AI Core deployment.
- Parameters:
request (httpx.Request) -- The original HTTPX request.
- Returns:
The HTTPX response from the AI Core deployment.
- Return type:
httpx.Response
- class Client
Bases:
ClientUnified, native-feeling client that dynamically routes requests through SAP AI Core deployments based on the requested identifiers e.g. model name.
- __init__(vertexai=True, project='placeholder', location='placeholder', deployment_id='', config_id='', config_name='', proxy_client=None, timeout=None, **kwargs)
Initializes the Client.
- Parameters:
vertexai (bool, optional) -- to indicate Vertex AI usage, defaults to True
project (str, optional) -- the GCP project, defaults to "placeholder"
location (str, optional) -- the GCP location, defaults to "placeholder"
deployment_id (str, optional) -- the deployment identifier, defaults to ""
config_id (str, optional) -- the configuration identifier, defaults to ""
config_name (str, optional) -- the configuration name, defaults to ""
proxy_client (BaseProxyClient, optional) -- the proxy client to use, defaults to None
timeout (int, optional) -- the request timeout, defaults to None