| |
- builtins.object
-
- AICoreV2Client
class AICoreV2Client(builtins.object) |
|
AICoreV2Client(base_url: 'str', auth_url: 'str' = None, client_id: 'str' = None, client_secret: 'str' = None, token_creator: 'Callable[[], str]' = None, resource_group: 'str' = None, read_timeout=60, connect_timeout=60, num_request_retries=3)
The AICoreV2Client is the class implemented to interact with the AI Core endpoints. The user can use its
attributes corresponding to the resources, for interacting with endpoints related to that resource. (i.e.,
aicoreclient.scenario)
:param base_url: Base URL of the AI Core. Should include the base path as well. (i.e., "<base_url>/lm/scenarios"
should work)
:type base_url: str
:param auth_url: URL of the authorization endpoint. Should be the full URL (including /oauth/token), defaults to
None
:type auth_url: str, optional
:param client_id: client id to be used for authorization, defaults to None
:type client_id: str, optional
:param client_secret: client secret to be used for authorization, defaults to None
:type client_secret: str, optional
:param token_creator: the function which returns the Bearer token, when called. Either this, or
auth_url & client_id & client_secret should be specified, defaults to None
:type token_creator: Callable[[], str], optional
:param resource_group: The default resource group which will be used while sending the requests to the server. If
not set, the resource_group should be specified with every request to the server, defaults to None
:type resource_group: str, optional
:param read_timeout: Read timeout for requests in seconds, defaults to 60s
:type read_timeout: int
:param connect_timeout: Connect timeout for requests in seconds, defaults to 60s
:type connect_timeout: int
:param num_request_retries: Number of retries for failing requests with http status code 429, 500, 502, 503 or 504,
defaults to 60s
:type num_request_retries: int |
|
Methods defined here:
- __init__(self, base_url: 'str', auth_url: 'str' = None, client_id: 'str' = None, client_secret: 'str' = None, token_creator: 'Callable[[], str]' = None, resource_group: 'str' = None, read_timeout=60, connect_timeout=60, num_request_retries=3)
- Initialize self. See help(type(self)) for accurate signature.
Class methods defined here:
- from_env(profile_name: 'str' = None, raise_on_missing: 'bool' = True, **kwargs) -> 'AICoreV2Client' from builtins.type
- Alternative way to create an AICoreV2Client object.
Parameters for base_url, auth_url, client_id, client_secret and resource_group can be passed as keyword or
are pulled from environment variables. It is also possible to use a profile, which is a json file in the
config directory. The profile name can be passed as keyword or is pulled from the environment variable
AICORE_PROFILE. If no profile is specified, the default profile is used.
A specific path to a config that shoudl be used can be set via the environment variable AICORE_CONFIG.
The hierachy of precedence is:
1. keyword argument
2. environment variable
3. profile variable
:param profile_name: name of the profile to use, defaults to None. If None is passed, the profile is read from
the environment variable AICORE_PROFILE. If this is not set, the default profile is used.
The default profile is read from $AICORE_HOME/config.json.
:type base_url: optional, str
**kwargs: check the parameters of the class constructor
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |