Schema object classes and field types that define the structure and validation of data in Superlinked.

SchemaObject

SchemaObject(base_cls: type)
@schema decorated class that has multiple SchemaFields. Use it to represent your structured data to reference during the vector embedding process.

Descendants

Properties

schema_fields
Sequence[SchemaField]
Collection of schema fields that define the structure of this schema object.

SchemaField

SchemaField(name: str, schema_obj: SchemaObjectT, type_: type[SFT], nullable: bool)
A SchemaField is a generic field of your @schema decorated class. SchemaFields are the basic building block for inputs that will be referenced in an embedding space. Sub-types of a SchemaField are typed data representations that you can use to transform and load data to feed the vector embedding process.

Parameters

name
str
required
Name of the schema field.
schema_obj
SchemaObjectT
required
The schema object this field belongs to.
type_
type[SFT]
required
The type of the field.
nullable
bool
required
Whether the field can have null values.

Inheritance

Inheritance Chain:
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Descendants

  • CreatedAtField
  • SchemaReference
  • IdField
  • Blob
  • Boolean
  • FloatList
  • Number
  • String
  • StringList
  • Timestamp

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

as_type()

as_type(value: Any) -> SFT

parse()

parse(value: SFT) -> SFT

String

String(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a string value. e.g.: TextEmbeddingSpace expects a String field as an input.

Inheritance

Inheritance Chain:
  • String
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Number

Number(name: str, schema_obj: SchemaObjectT, type_: type[SFT], nullable: bool)
Field of a schema that represents a union of Float and Integer. e.g.: NumberSpace expects a Number field as an input.

Inheritance

Inheritance Chain:
  • Number
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Descendants

  • Float
  • Integer

Float

Float(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a float.

Inheritance

Inheritance Chain:
  • Float
  • Number
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Integer

Integer(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents an integer.

Inheritance

Inheritance Chain:
  • Integer
  • Number
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Boolean

Boolean(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a boolean.

Inheritance

Inheritance Chain:
  • Boolean
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

is_()

is_(value: bool) -> ComparisonOperation[SchemaField]
Equivalent to equality comparison for boolean fields. This method exists to avoid linter errors when comparing boolean fields.

is_not_()

is_not_(value: bool) -> ComparisonOperation[SchemaField]
Equivalent to inequality comparison for boolean fields. This method exists to avoid linter errors when comparing boolean fields.

Timestamp

Timestamp(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a unix timestamp. e.g.: RecencySpace expects a Timestamp field as an input.

Inheritance

Inheritance Chain:
  • Timestamp
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

as_type()

as_type(value: Any) -> int

Blob

Blob(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a local/remote file path or an utf-8 encoded bytes string. e.g.: ImageSpace expects a blob field as an input.

Inheritance

Inheritance Chain:
  • Blob
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

as_type()

as_type(value: Any) -> BlobInformation

StringList

StringList(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a list of strings.

Inheritance

Inheritance Chain:
  • StringList
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

as_type()

as_type(value: Any) -> list[str]

parse()

parse(value: list[str]) -> list[str]

FloatList

FloatList(name: str, schema_obj: SchemaObjectT, nullable: bool)
Field of a schema that represents a vector.

Inheritance

Inheritance Chain:
  • FloatList
  • SchemaField
  • ComparisonOperand
  • ABC
  • Generic

Properties

supported_comparison_operation_types
Sequence[ComparisonOperationType]
Sequence of supported comparison operation types for this field.

Methods

as_type()

as_type(value: Any) -> list[float]

parse()

parse(value: list[float]) -> list[float]

DescribedBlob

DescribedBlob(blob: Blob, description: String)

Properties

blob
Blob
The blob field containing the file or binary data.
description
String
The string field containing the description text.