%Library.Embedding
datatype class %Library.Embedding extends %Library.Vector
ODBC Type: VARCHAR
%Library.Embedding datatype is a subclass of %Library.Vector with DATATYPE="DOUBLE"The value stored in this property is a $vector. The IRIS engine keeps this embedding updated based on 'SOURCE' properties as these source property items are modified. The property value will be computed/recompiled when the record is saved as needed.
%Library.Embedding has the following property parameters:
- MODEL - Name of the embedding endpoint to use to construct embedding from the embedding endpoints table
- SOURCE - Comma separated list of property names of other properties in this class which are used as the source values for calculating the embedding. Names can be quoted with ' character to handle cases where referenced property name contains ',' characters. If a property referenced in this list does not exist it will throw a compile-time error. Wild card '*' indicator is supported and any name prefixed by '-' will remove this specific property from the list.
The LEN property parameter will be read from the MODEL embedding endpoint table and inserted as a property parameter automatically, so the user does not need to specify this explicitly. This means the LEN becomes fixed at compile-time based on the endpoint table value for length.
If none of the SOURCE properties are modified, and this is an update to an existing %Persistent instance we will not recompile the embedding value when this instance is saved.
When a new embedding needs to be computed, a dynamic object based on the SOURCE properties will be constructued with the key being the property name and the value being the data value that is passed to the endpoint interfaces 'Embedding' or 'EmbeddingList' along with the MODEL endpoint name and the configuration information read from the endpoint table.
Example:
property MyEmbed as %Embedding(MODEL='text-embedding-3-small', SOURCE='Description,Name');
This definition generates ComputeOnChange logic for Description and Name properties of this class to update this property by calling the 'Embedding' method of the endpoint interface class when either of these change.
It stores a single embedding value for the description, name no matter how long these fields are.
To handle multiple embeddings, we also support the 'list of' collection syntax:
property MyEmbed as List Of %Embedding(MODEL='text-embedding-3-small', SOURCE='Description,Name');
This calls the 'EmbeddingList' method of the endpoint interface class and stores the list of embeddings that are returned.
This list collection will be projected to SQL as a child table to allow JOIN queries between the embeddings and the parent table.
Parameters
Inherited Members
Inherited Methods