aixplain.modules.model.record
Record Objects
class Record()
A class representing a record in an index.
This class defines the structure of a record with its value, type, ID, URI, and attributes.
__init__
def __init__(value: str = "",
value_type: DataType = DataType.TEXT,
id: Optional[str] = None,
uri: str = "",
attributes: dict = {})
Initialize a new Record instance.
Arguments:
value
str - The value of the record.value_type
DataType - The type of the value.id
Optional[str] - The ID of the record. Defaults to a random UUID.uri
str - The URI of the record.attributes
dict - The attributes of the record.
to_dict
def to_dict()
Convert the record to a dictionary.
Returns:
dict
- A dictionary containing the record's value, type, ID, URI, and attributes.
validate
def validate()
Validate the record.
Raises:
AssertionError
- If the value type is invalid or if the URI is required for image records.