gen_ai_hub packageΒΆ

class gen_ai_hub.GenAIHubProxyClient(*, base_url: str | None = None, auth_url: str | None = None, client_id: str | None = None, client_secret: str | None = None, resource_group: str | None = None, ai_core_client: AICoreV2Client | None = None, **extra_data: Any)ΒΆ

Bases: BaseProxyClient

GenAIHubProxyClient is a proxy client for interacting with the GenAI Hub.

AI_CLIENT_TYPE_VAL: ClassVar[str] = 'GenAI Hub SDK (Python)'ΒΆ
classmethod add_foundation_model_scenario(scenario_id, config_names: List[str] | None = None, prediction_url_suffix: str | None = None, model_name_parameter: str = 'model_name')ΒΆ

Add a foundational model scenario to the client.

Parameters:
  • scenario_id (str) – the scenario ID.

  • config_names (Optional[List[str]], optional) – list of configuration names, defaults to None

  • prediction_url_suffix (Optional[str], optional) – prediction URL suffix, defaults to None

  • model_name_parameter (str, optional) – model name parameter, defaults to β€˜model_name’

default_values: ClassVar[Dict[str, Any]] = {}ΒΆ
property deployment_class: Type[Deployment]ΒΆ
property deployments: List[Deployment]ΒΆ
classmethod for_profile(profile: str = None)ΒΆ

Create a GenAIHubProxyClient instance for the given profile.

Parameters:

profile (str, optional) – Profile name, defaults to None

Returns:

GenAIHubProxyClient instance.

Return type:

GenAIHubProxyClient

foundational_model_scenarios: ClassVar[List[FoundationalModelScenario]] = [FoundationalModelScenario(scenario_id='foundation-models', config_names=['*'], model_name_parameter='model_name', prediction_url_suffix=None)]ΒΆ
get_additional_headers() Dict[str, str]ΒΆ

Get only the additional headers (instance-level and request-level).

Returns:

Additional headers.

Return type:

Dict[str, str]

get_ai_core_token()ΒΆ

Get the AI core token for authentication.

Returns:

AI core token.

Return type:

str

get_deployments()ΒΆ

Get the list of deployments.

Returns:

List of deployments.

Return type:

List[Deployment]

get_request_header()ΒΆ

Get the request headers for requests made by the client.

Returns:

Request headers.

Return type:

Dict[str, str]

classmethod init_client(data: Any) AnyΒΆ

Initialize the client with the provided data.

Parameters:

data (Any) – Input data for client initialization.

Returns:

Initialized data.

Return type:

Any

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': ()}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) NoneΒΆ

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

on_invalid_deployments: ClassVar[InvalidDeploymentBehavior] = 'warn'ΒΆ
property request_header: Dict[str, Any]ΒΆ
select_deployment(raise_on_multiple: bool = False, **search_key_value)ΒΆ
classmethod set_default_values(**kwargs)ΒΆ

Set default values for the client.

set_headers_addition(headers: Dict[str, str])ΒΆ

Set additional headers for requests made by the client.

Parameters:

headers (Dict[str, str]) – Headers to add.

update_deployments()ΒΆ

Update the list of deployments from the GenAI Hub.

Returns:

List of updated deployments.

Return type:

List[Deployment]

base_url: str | NoneΒΆ
auth_url: str | NoneΒΆ
client_id: str | NoneΒΆ
client_secret: str | NoneΒΆ
resource_group: str | NoneΒΆ
ai_core_client: AICoreV2Client | NoneΒΆ

SubpackagesΒΆ