aiq.data_models.discovery_metadata#

Attributes#

Classes#

DiscoveryStatusEnum

str(object='') -> str

DiscoveryContractFieldsEnum

str(object='') -> str

DiscoveryMetadata

A data model representing metadata about each registered component to faciliate its discovery.

Module Contents#

logger#
class DiscoveryStatusEnum#

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

Initialize self. See help(type(self)) for accurate signature.

SUCCESS = 'success'#
FAILURE = 'failure'#
class DiscoveryContractFieldsEnum#

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

Initialize self. See help(type(self)) for accurate signature.

PACKAGE = 'package'#
VERSION = 'version'#
COMPONENT_TYPE = 'component_type'#
COMPONENT_NAME = 'component_name'#
DESCRIPTION = 'description'#
DEVELOPER_NOTES = 'developer_notes'#
class DiscoveryMetadata(/, **data: Any)#

Bases: pydantic.BaseModel

A data model representing metadata about each registered component to faciliate its discovery.

Args:

package (str): The name of the package containing the AgentIQ component. version (str): The version number of the package containing the AgentIQ component. component_type (AIQComponentEnum): The type of AgentIQ component this metadata represents. component_name (str): The registered name of the AgentIQ component. description (str): Description of the AgentIQ component pulled from its config objects docstrings. developer_notes (str): Other notes to a developers to aid in the use of the component. status (DiscoveryStatusEnum): Provides the status of the metadata discovery process.

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.

self is explicitly positional-only to allow self as a field name.

package: str = ''#
version: str = ''#
component_type: aiq.data_models.component.AIQComponentEnum#
component_name: str = ''#
description: str = ''#
developer_notes: str = ''#
status: DiscoveryStatusEnum#
classmethod ensure_description_string(v: Any)#
static get_preferred_item(items: list, preferred: str) str#
static get_distribution_name_from_metadata(
root_package_name: str,
) str | None#

This is not performant and is only present to be used (not used currently) as a fallback when the distro name doesn’t match the module name and private_data is not available to map it.

static get_distribution_name_from_private_data(
root_package: str,
) str | None#
static get_distribution_name(root_package: str) str#

The aiq library packages use a distro name ‘agentiq[]’ and root package name ‘aiq’. They provide mapping in a metadata file for optimized installation.

static from_config_type(
config_type: type[aiq.data_models.common.TypedBaseModelT],
component_type: aiq.data_models.component.AIQComponentEnum = AIQComponentEnum.UNDEFINED,
) DiscoveryMetadata#

Generates discovery metadata from an AgentIQ config object.

Args:

config_type (type[TypedBaseModelT]): A registered component’s configuration object. component_type (AIQComponentEnum, optional): The type of the registered component. Defaults to AIQComponentEnum.UNDEFINED.

Returns:

DiscoveryMetadata: A an object containing component metadata to facilitate discovery and reuse.

static from_fn_wrapper(
fn: aiq.cli.type_registry.ToolWrapperBuildCallableT,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
component_type: aiq.data_models.component.AIQComponentEnum = AIQComponentEnum.TOOL_WRAPPER,
) DiscoveryMetadata#

Generates discovery metadata from function with specified wrapper type.

Args:

fn (ToolWrapperBuildCallableT): A tool wrapper callable to source component metadata. wrapper_type (LLMFrameworkEnum): The wrapper to apply to the callable to faciliate inter-framwork interoperability.

component_type (AIQComponentEnum, optional): The type of the registered component. Defaults to AIQComponentEnum.TOOL_WRAPPER.

Returns:

DiscoveryMetadata: A an object containing component metadata to facilitate discovery and reuse.

static from_package_name(
package_name: str,
package_version: str | None,
) DiscoveryMetadata#

Generates discovery metadata from an installed package name.

Args:

package_name (str): The name of the AgentIQ plugin package containing registered components. package_version (str, optional): The version of the package, Defaults to None.

Returns:

DiscoveryMetadata: A an object containing component metadata to facilitate discovery and reuse.

static from_provider_framework_map(
config_type: type[aiq.data_models.common.TypedBaseModelT],
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str | None,
provider_type: aiq.data_models.component.AIQComponentEnum,
component_type: aiq.data_models.component.AIQComponentEnum = AIQComponentEnum.UNDEFINED,
) DiscoveryMetadata#

Generates discovery metadata from provider and framework mapping information.

Args:

config_type (type[TypedBaseModelT]): A registered component’s configuration object. wrapper_type (LLMFrameworkEnum | str): The wrapper to apply to the callable to faciliate inter-framwork interoperability.

provider_type (AIQComponentEnum): The type of provider the registered component supports. component_type (AIQComponentEnum, optional): The type of the registered component. Defaults to AIQComponentEnum.UNDEFINED.

Returns:

DiscoveryMetadata: A an object containing component metadata to facilitate discovery and reuse.