แชร์ผ่าน


IEmbeddingGenerator<TInput,TEmbedding> Interface

Definition

Represents a generator of embeddings.

generic <typename TInput, typename TEmbedding>
 where TEmbedding : Embeddingpublic interface class IEmbeddingGenerator : IDisposable
public interface IEmbeddingGenerator<TInput,TEmbedding> : IDisposable where TEmbedding : Embedding
type IEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)> = interface
    interface IDisposable
Public Interface IEmbeddingGenerator(Of TInput, TEmbedding)
Implements IDisposable

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The type of embeddings to generate.

Derived
Implements

Remarks

Unless otherwise specified, all members of IEmbeddingGenerator<TInput,TEmbedding> are thread-safe for concurrent use. It is expected that all implementations of IEmbeddingGenerator<TInput,TEmbedding> support being used by multiple requests concurrently.

However, implementations of IEmbeddingGenerator<TInput,TEmbedding> may mutate the arguments supplied to GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken), such as by adding additional values to the values list or configuring the options instance. Thus, consumers of the interface either should avoid using shared instances of these arguments for concurrent invocations or should otherwise ensure by construction that no IEmbeddingGenerator<TInput,TEmbedding> instances are used which might employ such mutation.

Properties

Metadata

Gets metadata that describes the IEmbeddingGenerator<TInput,TEmbedding>.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from IDisposable)
GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)

Generates embeddings for each of the supplied values.

GetService<TService>(Object)

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService.

Extension Methods

GenerateAndZipAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)

Generates embeddings for each of the supplied values and produces a list that pairs each input value with its resulting embedding.

GenerateEmbeddingAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, TInput, EmbeddingGenerationOptions, CancellationToken)

Generates an embedding from the specified value.

Applies to