Table of Contents

Method Import

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

Import(Attachment, IChunking, string, string, CancellationToken)

Imports content from a single Attachment into a DataSource, creating a new section with a custom chunking strategy.

public DataSource Import(Attachment attachment, IChunking chunker, string dataSourceIdentifier, string sectionIdentifier, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment containing the content to import.

chunker IChunking

The chunking strategy for splitting the extracted text. If null, DefaultIChunking is used.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section created from the attachment's content.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachment, dataSourceIdentifier, or sectionIdentifier is null or empty.

Import(Attachment, string, string, CancellationToken)

Imports content from a single Attachment into a DataSource, creating a new section.

public DataSource Import(Attachment attachment, string dataSourceIdentifier, string sectionIdentifier, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment containing the content to import.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section created from the attachment's content.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachment, dataSourceIdentifier, or sectionIdentifier is null or empty.

Import(Attachment, IChunking, string, string, MetadataCollection, CancellationToken)

Imports content from a single Attachment into a DataSource, creating a new section with a custom chunking strategy and attaching additional metadata.

public DataSource Import(Attachment attachment, IChunking chunker, string dataSourceIdentifier, string sectionIdentifier, MetadataCollection additionalMetadata, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment containing the content to import.

chunker IChunking

The chunking strategy for splitting the extracted text. If null, DefaultIChunking is used.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section created from the attachment's content.

additionalMetadata MetadataCollection

Metadata to associate with the imported section.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachment, dataSourceIdentifier, or sectionIdentifier is null or empty.

Import(Attachment, string, string, MetadataCollection, CancellationToken)

Imports content from a single Attachment into a DataSource, creating a new section and attaching additional metadata.

public DataSource Import(Attachment attachment, string dataSourceIdentifier, string sectionIdentifier, MetadataCollection additionalMetadata, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment containing the content to import.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section created from the attachment's content.

additionalMetadata MetadataCollection

Metadata to associate with the imported section.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachment, dataSourceIdentifier, or sectionIdentifier is null or empty.

Import(IList<Attachment>, string, IList<string>, IList<MetadataCollection>, CancellationToken)

Imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment.

public DataSource Import(IList<Attachment> attachments, string dataSourceIdentifier, IList<string> sectionIdentifiers, IList<MetadataCollection> metadataCollections = null, CancellationToken cancellationToken = default)

Parameters

attachments IList<Attachment>

A list of attachments containing the content to import.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as new sections; otherwise, a new data source is created.

sectionIdentifiers IList<string>

A list of unique identifiers for the sections corresponding to each attachment. The count must match the number of attachments.

metadataCollections IList<MetadataCollection>

An optional list of metadata collections to associate with each imported section. If provided, the count must match the number of attachments.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachments, dataSourceIdentifier, or sectionIdentifiers is null or empty.

ArgumentOutOfRangeException

Thrown if the count of sectionIdentifiers (or metadataCollections, if provided) does not match the number of attachments.

Import(IList<Attachment>, IChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)

Imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment with a custom chunking strategy.

public DataSource Import(IList<Attachment> attachments, IChunking chunker, string dataSourceIdentifier, IList<string> sectionIdentifiers, IList<MetadataCollection> metadataCollections = null, CancellationToken cancellationToken = default)

Parameters

attachments IList<Attachment>

A list of attachments containing the content to import.

chunker IChunking

The chunking strategy for splitting the extracted text. If null, DefaultIChunking is used.

dataSourceIdentifier string

The unique identifier for the target DataSource. If a matching data source exists, the content is added as new sections; otherwise, a new data source is created.

sectionIdentifiers IList<string>

A list of unique identifiers for the sections corresponding to each attachment. The count must match the number of attachments.

metadataCollections IList<MetadataCollection>

An optional list of metadata collections to associate with each imported section. If provided, the count must match the number of attachments.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported content.

Exceptions

ArgumentNullException

Thrown if attachments, dataSourceIdentifier, or sectionIdentifiers is null or empty.

ArgumentOutOfRangeException

Thrown if the count of sectionIdentifiers (or metadataCollections, if provided) does not match the number of attachments.

Import(ImageBuffer, string, string, CancellationToken)

Imports a single image into a DataSource, creating a new section.

public DataSource Import(ImageBuffer image, string dataSourceIdentifier, string sectionIdentifier, CancellationToken cancellationToken = default)

Parameters

image ImageBuffer

The image buffer to import.

dataSourceIdentifier string

The unique identifier for the target DataSource. If the identifier exists, the image is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported image.

Remarks

This method requires a vision-enabled embedding model to be registered with the engine.

Exceptions

ArgumentNullException

Thrown if image or dataSourceIdentifier is null or empty.

ArgumentException

Thrown if no vision-enabled embedding model is registered with the engine.

Import(ImageBuffer, string, string, MetadataCollection, CancellationToken)

Imports a single image into a DataSource, creating a new section and attaching additional metadata.

public DataSource Import(ImageBuffer image, string dataSourceIdentifier, string sectionIdentifier, MetadataCollection additionalMetadata, CancellationToken cancellationToken = default)

Parameters

image ImageBuffer

The image buffer to import.

dataSourceIdentifier string

The unique identifier for the target DataSource. If the identifier exists, the image is added as a new section; otherwise, a new data source is created.

sectionIdentifier string

The identifier for the new section.

additionalMetadata MetadataCollection

Metadata to associate with the imported section.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The DataSource containing the imported image.

Remarks

This method requires a vision-enabled embedding model to be registered with the engine.

Exceptions

ArgumentNullException

Thrown if image or dataSourceIdentifier is null or empty.

ArgumentException

Thrown if no vision-enabled embedding model is registered with the engine.

Import(IList<ImageBuffer>, string, IList<string>, IList<MetadataCollection>, CancellationToken)

Imports multiple images into a DataSource, creating a new section for each.

public DataSource Import(IList<ImageBuffer> images, string dataSourceIdentifier, IList<string> sectionIdentifiers, IList<MetadataCollection> metadataCollections = null, CancellationToken cancellationToken = default)

Parameters

images IList<ImageBuffer>

A list of image buffers to import, each representing a separate section.

dataSourceIdentifier string

The unique identifier for the target DataSource. If the data source exists, new sections are added; otherwise, a new data source is created.

sectionIdentifiers IList<string>

A list of unique identifiers for the new sections. The count must match the number of images.

metadataCollections IList<MetadataCollection>

An optional list of metadata collections to associate with each imported section. If provided, the count must match the number of images.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

DataSource

The updated or newly created DataSource containing the imported images.

Remarks

This method requires a vision-enabled embedding model to be registered with the engine.

Exceptions

ArgumentNullException

Thrown if images or dataSourceIdentifier is null or empty.

ArgumentOutOfRangeException

Thrown if the count of sectionIdentifiers does not match the count of images.

ArgumentException

Thrown if no vision-enabled embedding model is registered with the engine.