Skip to main content
Version: 1.0

aixplain.v2.core

Aixplain Objects

class Aixplain()

[view_source]

Main class for the Aixplain API.

Attributes:

  • _instance - Aixplain: The unique instance of the Aixplain class.
  • api_key - str: The API key for the Aixplain API.
  • base_url - str: The URL for the backend.
  • pipeline_url - str: The URL for the pipeline.
  • model_url - str: The URL for the model.
  • client - AixplainClient: The client for the Aixplain API.
  • Model - type: The model class.
  • Pipeline - type: The pipeline class.
  • Agent - type: The agent class.
  • Benchmark - type: The benchmark class.
  • api_key0 - type: The benchmark job class.

__new__

def __new__(cls, *args, **kwargs)

[view_source]

Singleton pattern for the Aixplain class. Otherwise, the environment variables will be overwritten in multiple instances.

TODO: This should be removed once the factory classes are removed.

__init__

def __init__(api_key: str = None,
backend_url: str = None,
pipeline_url: str = None,
model_url: str = None)

[view_source]

Initialize the Aixplain class.

Arguments:

  • api_key - str: The API key for the Aixplain API.
  • backend_url - str: The URL for the backend.
  • pipeline_url - str: The URL for the pipeline.
  • model_url - str: The URL for the model.

init_client

def init_client()

[view_source]

Initialize the client.

init_env

def init_env()

[view_source]

Initialize the environment variables.

This is required for the legacy use of the factory classes.

init_resources

def init_resources()

[view_source]

Initialize the resources.

We're dynamically creating the classes here to avoid potential race conditions when using class level attributes