EmbeddedDocument

Wisej.AI.Embeddings.EmbeddedDocument

Namespace: Wisej.AI.Embeddings

Assembly: Wisej.AI (3.5.0.0)

Represents a document that can be embedded with metadata and embedding data.

public class EmbeddedDocument : ICloneable

The EmbeddedDocument class is designed to hold information about a document that can be embedded within a system. It contains properties for the document's name, metadata, and embedding data. This class provides constructors for initializing a document with or without embedding data. The embedded documents can be used in systems that require document similarity measures or need to store additional metadata for each document.

Constructors

EmbeddedDocument(name, metadata, embedding)

Initializes a new instance of the EmbeddedDocument class with the specified name, metadata, and embedding.

Name
Type
Description

name

The name of the document. Cannot be null.

metadata

Optional metadata associated with the document. If null, a new Metadata instance is created.

embedding

Optional embedding data for the document.

Throws:

Properties

Metadata

Metadata: Gets the metadata of the document.

Name

String: Gets the name of the document.

Methods

Clone(includeEmbedding)

Creates a deep copy of the current EmbeddedDocument instance.

Parameter
Type
Description

includeEmbedding

Whether to clone the embeddings.

Returns: EmbeddedDocument. A new EmbeddedDocument instance that is a deep copy of the current instance.

GetEmbedding()

Retrieves the embedding data associated with the document.

Returns: Embedding. The embedding data of the document.

GetMatches()

Returns: Matches.

SetEmbedding(embedding)

Sets the embedding data for the document.

Parameter
Type
Description

embedding

The embedding data to set for the document.

Returns: EmbeddedDocument. The current instance of EmbeddedDocument with updated embedding data.

Use this method to update the embedding data of an existing document. This might be necessary when the document's context or representation changes.


  var document = new EmbeddedDocument("SampleDoc");
  var newEmbedding = new Embedding();
  document.SetEmbedding(newEmbedding);

SetMatches(matches)

Parameter
Type
Description

matches

Returns: EmbeddedDocument.

Last updated