gen_ai_hub.proxy.native.amazon.clients
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/proxy/native/amazon/clients.py

 
Modules
       
contextvars

 
Classes
       
boto3.session.Session(builtins.object)
Session
botocore.client.BaseClient(builtins.object)
ClientWrapper

 
class ClientWrapper(botocore.client.BaseClient)
    ClientWrapper(client, aicore_deployment, aicore_proxy_client)
 
Wraps and extends the boto3 BedrockRuntime class.
boto3 is implemented in a way that a bedrock runtime
class is created on the fly. Regular inheritance is
therefor not possible. Instead, this wrapper inherits
from the boto3 BaseClient class and is initialised
with an instance of the bedrock runtime object. All
attributes of the bedrock runtime object are copied
over to the ClientWrapper object. Methods that need
to be adjusted are regularly overwritten in case they
are defined in the base class BaseClient (orginating
from botocore). In case methods need to be adjusted
that are dynamically added, they are also overwritten
in regular fashion. The linter will not be able to verify
the super methods existence though.
 
 
Method resolution order:
ClientWrapper
botocore.client.BaseClient
builtins.object

Methods defined here:
__init__(self, client, aicore_deployment, aicore_proxy_client)
Initialize self.  See help(type(self)) for accurate signature.
converse(self, *args, **kwargs)
Tolerates missing parameters and calls original
converse method.
converse_stream(self, *args, **kwargs)
Tolerates missing parameters and calls original
converse_stream method.
invoke_model(self, *args, **kwargs)
Tolerates missing parameters and calls original
invoke_model method.
invoke_model_with_response_stream(self, *args, **kwargs)
Tolerates missing parameters and calls original
invoke_model_with_response_stream method.

Data and other attributes defined here:
STREAMING_NOT_IMPLEMENTED_MSG = 'Streaming for Amazon Titan models not enabled in SAP AI Core.'

Methods inherited from botocore.client.BaseClient:
__getattr__(self, item)
can_paginate(self, operation_name)
Check if an operation can be paginated.
 
:type operation_name: string
:param operation_name: The operation name.  This is the same name
    as the method name on the client.  For example, if the
    method name is ``create_foo``, and you'd normally invoke the
    operation as ``client.create_foo(**kwargs)``, if the
    ``create_foo`` operation can be paginated, you can use the
    call ``client.get_paginator("create_foo")``.
 
:return: ``True`` if the operation can be paginated,
    ``False`` otherwise.
close(self)
Closes underlying endpoint connections.
get_paginator(self, operation_name)
Create a paginator for an operation.
 
:type operation_name: string
:param operation_name: The operation name.  This is the same name
    as the method name on the client.  For example, if the
    method name is ``create_foo``, and you'd normally invoke the
    operation as ``client.create_foo(**kwargs)``, if the
    ``create_foo`` operation can be paginated, you can use the
    call ``client.get_paginator("create_foo")``.
 
:raise OperationNotPageableError: Raised if the operation is not
    pageable.  You can use the ``client.can_paginate`` method to
    check if an operation is pageable.
 
:rtype: ``botocore.paginate.Paginator``
:return: A paginator object.
get_waiter(self, waiter_name)
Returns an object that can wait for some condition.
 
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters
    section of the service docs for a list of available waiters.
 
:returns: The specified waiter object.
:rtype: ``botocore.waiter.Waiter``
waiter_names = <botocore.utils.CachedProperty object>
Readonly properties inherited from botocore.client.BaseClient:
exceptions

Data descriptors inherited from botocore.client.BaseClient:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Session(boto3.session.Session)
    Session(aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, region_name=None, botocore_session=None, profile_name=None)
 
Drop-in replacement for boto3.Session that uses
the current deployment for amazon titan models
 
 
Method resolution order:
Session
boto3.session.Session
builtins.object

Methods defined here:
client(self, *args, model: str = '', deployment_id: str = '', model_name: str = '', config_id: str = '', config_name: str = '', proxy_client: Optional[gen_ai_hub.proxy.core.base.BaseProxyClient] = None, **kwargs)
Create a low-level service client by name.
 
:type service_name: string
:param service_name: The name of a service, e.g. 's3' or 'ec2'. You
    can get a list of available services via
    :py:meth:`get_available_services`.
 
:type region_name: string
:param region_name: The name of the region associated with the client.
    A client is associated with a single region.
 
:type api_version: string
:param api_version: The API version to use.  By default, botocore will
    use the latest API version when creating a client.  You only need
    to specify this parameter if you want to use a previous API version
    of the client.
 
:type use_ssl: boolean
:param use_ssl: Whether or not to use SSL.  By default, SSL is used.
    Note that not all services support non-ssl connections.
 
:type verify: boolean/string
:param verify: Whether or not to verify SSL certificates.  By default
    SSL certificates are verified.  You can provide the following
    values:
 
    * False - do not validate SSL certificates.  SSL will still be
      used (unless use_ssl is False), but SSL certificates
      will not be verified.
    * path/to/cert/bundle.pem - A filename of the CA cert bundle to
      uses.  You can specify this argument if you want to use a
      different CA cert bundle than the one used by botocore.
 
:type endpoint_url: string
:param endpoint_url: The complete URL to use for the constructed
    client. Normally, botocore will automatically construct the
    appropriate URL to use when communicating with a service.  You
    can specify a complete URL (including the "http/https" scheme)
    to override this behavior.  If this value is provided,
    then ``use_ssl`` is ignored.
 
:type aws_access_key_id: string
:param aws_access_key_id: The access key to use when creating
    the client.  This is entirely optional, and if not provided,
    the credentials configured for the session will automatically
    be used.  You only need to provide this argument if you want
    to override the credentials used for this specific client.
 
:type aws_secret_access_key: string
:param aws_secret_access_key: The secret key to use when creating
    the client.  Same semantics as aws_access_key_id above.
 
:type aws_session_token: string
:param aws_session_token: The session token to use when creating
    the client.  Same semantics as aws_access_key_id above.
 
:type config: botocore.client.Config
:param config: Advanced client configuration options. If region_name
    is specified in the client config, its value will take precedence
    over environment variables and configuration values, but not over
    a region_name value passed explicitly to the method. See
    `botocore config documentation
    <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html>`_
    for more details.
 
:return: Service client instance

Methods inherited from boto3.session.Session:
__init__(self, aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, region_name=None, botocore_session=None, profile_name=None)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
get_available_partitions(self)
Lists the available partitions
 
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"])
get_available_regions(self, service_name, partition_name='aws', allow_non_regional=False)
Lists the region and endpoint names of a particular partition.
 
The list of regions returned by this method are regions that are
explicitly known by the client to exist and is not comprehensive. A
region not returned in this list may still be available for the
provided service.
 
:type service_name: string
:param service_name: Name of a service to list endpoint for (e.g., s3).
 
:type partition_name: string
:param partition_name: Name of the partition to limit endpoints to.
    (e.g., aws for the public AWS endpoints, aws-cn for AWS China
    endpoints, aws-us-gov for AWS GovCloud (US) Endpoints, etc.)
 
:type allow_non_regional: bool
:param allow_non_regional: Set to True to include endpoints that are
     not regional endpoints (e.g., s3-external-1,
     fips-us-gov-west-1, etc).
 
:return: Returns a list of endpoint names (e.g., ["us-east-1"]).
get_available_resources(self)
Get a list of available services that can be loaded as resource
clients via :py:meth:`Session.resource`.
 
:rtype: list
:return: List of service names
get_available_services(self)
Get a list of available services that can be loaded as low-level
clients via :py:meth:`Session.client`.
 
:rtype: list
:return: List of service names
get_credentials(self)
Return the :class:`botocore.credentials.Credentials` object
associated with this session.  If the credentials have not
yet been loaded, this will attempt to load them.  If they
have already been loaded, this will return the cached
credentials.
get_partition_for_region(self, region_name)
Lists the partition name of a particular region.
 
:type region_name: string
:param region_name: Name of the region to list partition for (e.g.,
     us-east-1).
 
:rtype: string
:return: Returns the respective partition name (e.g., aws).
resource(self, service_name, region_name=None, api_version=None, use_ssl=True, verify=None, endpoint_url=None, aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, config=None)
Create a resource service client by name.
 
:type service_name: string
:param service_name: The name of a service, e.g. 's3' or 'ec2'. You
    can get a list of available services via
    :py:meth:`get_available_resources`.
 
:type region_name: string
:param region_name: The name of the region associated with the client.
    A client is associated with a single region.
 
:type api_version: string
:param api_version: The API version to use.  By default, botocore will
    use the latest API version when creating a client.  You only need
    to specify this parameter if you want to use a previous API version
    of the client.
 
:type use_ssl: boolean
:param use_ssl: Whether or not to use SSL.  By default, SSL is used.
    Note that not all services support non-ssl connections.
 
:type verify: boolean/string
:param verify: Whether or not to verify SSL certificates.  By default
    SSL certificates are verified.  You can provide the following
    values:
 
    * False - do not validate SSL certificates.  SSL will still be
      used (unless use_ssl is False), but SSL certificates
      will not be verified.
    * path/to/cert/bundle.pem - A filename of the CA cert bundle to
      uses.  You can specify this argument if you want to use a
      different CA cert bundle than the one used by botocore.
 
:type endpoint_url: string
:param endpoint_url: The complete URL to use for the constructed
    client. Normally, botocore will automatically construct the
    appropriate URL to use when communicating with a service.  You
    can specify a complete URL (including the "http/https" scheme)
    to override this behavior.  If this value is provided,
    then ``use_ssl`` is ignored.
 
:type aws_access_key_id: string
:param aws_access_key_id: The access key to use when creating
    the client.  This is entirely optional, and if not provided,
    the credentials configured for the session will automatically
    be used.  You only need to provide this argument if you want
    to override the credentials used for this specific client.
 
:type aws_secret_access_key: string
:param aws_secret_access_key: The secret key to use when creating
    the client.  Same semantics as aws_access_key_id above.
 
:type aws_session_token: string
:param aws_session_token: The session token to use when creating
    the client.  Same semantics as aws_access_key_id above.
 
:type config: botocore.client.Config
:param config: Advanced client configuration options. If region_name
    is specified in the client config, its value will take precedence
    over environment variables and configuration values, but not over
    a region_name value passed explicitly to the method.  If
    user_agent_extra is specified in the client config, it overrides
    the default user_agent_extra provided by the resource API. See
    `botocore config documentation
    <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html>`_
    for more details.
 
:return: Subclass of :py:class:`~boto3.resources.base.ServiceResource`

Readonly properties inherited from boto3.session.Session:
available_profiles
The profiles available to the session credentials
events
The event emitter for a session
profile_name
The **read-only** profile name.
region_name
The **read-only** region name.

Data descriptors inherited from boto3.session.Session:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
get_current_deployment()
set_deployment(value)

 
Data
        Optional = typing.Optional
UNSIGNED = <botocore.UNSIGNED object>