IEmbeddingGenerator<TInput,TEmbedding> Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a generator of embeddings.
generic <typename TInput, typename TEmbedding>
where TEmbedding : Embeddingpublic interface class IEmbeddingGenerator : IDisposable, Microsoft::Extensions::AI::IEmbeddingGenerator
public interface IEmbeddingGenerator<in TInput,TEmbedding> : IDisposable, Microsoft.Extensions.AI.IEmbeddingGenerator where TEmbedding : Embedding
type IEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)> = interface
interface IEmbeddingGenerator
interface IDisposable
Public Interface IEmbeddingGenerator(Of In TInput, TEmbedding)
Implements IDisposable, IEmbeddingGenerator
Type Parameters
- TInput
The type from which embeddings will be generated.
This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.- 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. Instances must not be disposed of while the instance is still in use.
However, implementations of IEmbeddingGenerator<TInput,TEmbedding> may mutate the arguments supplied to GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken), such as by 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.
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 |
GetService(Type, Object) |
Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of the specified type |