Client configuration#

Where to start#

You start by creating a SimAIClient instance:

import ansys.simai.core

simai = ansys.simai.core.SimAIClient(organization="my-company")

As demonstrated in the preceding code, you configure the instance by passing the required parameters on client creation. You are prompted for any missing parameters.

Once you understand how creating an instance works, you can look into using a configuration file for creating a client instance.

Configuration options#

Descriptions follow of all configuration options for the SimAIClient class:

pydantic model ClientConfig#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

field credentials: Credentials | None = None#

Authenticate via username/password instead of the device authorization code.

field disable_cache: bool = False#

Don’t use cached authentication tokens.

field https_proxy: Url | None = None#

URL of the HTTPS proxy to use.

field interactive: bool | None = True#

If True, it enables interaction with the terminal.

field no_sse_connection: bool = False#

Don’t receive live updates from the SimAI API.

field organization: str = None#

Name of the organization(/company) that the user belongs to.

field project: str | None = None#

Name of the project to use by default.

field skip_version_check: bool = False#

Skip checking for updates.

field url: Url = Url('https://api.simai.ansys.com/v2/')#

URL to the SimAI API.

Constraints:
  • max_length = 2083

  • allowed_schemes = [‘http’, ‘https’]

field workspace: str | None = None#

Name of the workspace to use by default.

classmethod clean_url(url)#

Credentials#

To use the SimAI API, your SimAIClient instance must be authenticated. By default, you are prompted to log in via your web browser. However, you can pass your credentials as parameters on client creation:

simai = ansys.simai.core.SimAIClient(
    organization="company",
    credentials={
        # neither of these are required, but if they are missing you will be
        # prompted to input them
        "username": "user@company.com",
        "password": "hunter12",
    },
)

Credential options#

Descriptions follow of all credential options for the SimAIClient class:

pydantic model Credentials#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

Fields:
field password: str [Required]#

Password: Required if Credentials is defined, automatically prompted.

field totp: str | None = None#

One-time password: required if totp_enabled=True, automatically prompted.

field username: str [Required]#

Username: Required if Credentials is defined, automatically prompted.

Interactive mode#

When the property interactive is set to true, the users will be prompted for the missing configuration properties. When the property is false, the interactive mode is disabled, and errors would be raised in case of missing configuration properties. Default behavior is interactive=true.

It is important to note that login through web browser is disabled and credentials become required when interactive=false. This means that if the credentials are missing, the users won’t be prompted to enter them from the terminal, and an error would be raised instead.