Skip to main content
Version: 1.0

aixplain.enums.license

__author__

Copyright 2023 The aiXplain SDK authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: aiXplain team Date: March 20th 2023 Description: License Enum

LicenseMetadata Objects

@dataclass
class LicenseMetadata()

[view_source]

Metadata container for license information.

This class holds metadata about a license including its identifier, name, description, URL, and custom URL settings.

Attributes:

  • id str - ID of the license.
  • name str - Name of the license.
  • description str - Description of the license terms.
  • url str - URL to the license text or details.
  • allowCustomUrl bool - Whether custom URLs are allowed for this license.

to_dict

def to_dict() -> dict

[view_source]

Convert the license metadata to a dictionary.

Returns:

  • dict - Dictionary representation of the license metadata.

from_dict

@classmethod
def from_dict(cls, data: dict) -> "LicenseMetadata"

[view_source]

Create a LicenseMetadata instance from a dictionary.

Arguments:

  • data dict - Dictionary containing license metadata.

Returns:

  • LicenseMetadata - New instance created from the dictionary data.

load_licenses

def load_licenses() -> Enum

[view_source]

Load license definitions from the backend or cache.

This function attempts to load license definitions from the cache first. If the cache is invalid or doesn't exist, it fetches the data from the backend API. It creates a dynamic Enum class containing all available licenses.

Returns:

  • Enum - Dynamically created License enum class with license identifiers.

Raises:

  • Exception - If licenses cannot be loaded due to invalid API key or other errors.