14 instantiations of GeneratedEmbeddings
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
224return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(inputs.Select(i => new Embedding<float>(floats))));
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
225return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(inputs.Select(i => new Embedding<float>(floats))));
Microsoft.Extensions.AI.Abstractions.Tests (5)
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
37var expectedEmbedding = new GeneratedEmbeddings<Embedding<float>>([new(new float[] { 1.0f, 2.0f, 3.0f })]);
Embeddings\EmbeddingGeneratorExtensionsTests.cs (1)
58Task.FromResult<GeneratedEmbeddings<Embedding<float>>>(new(embeddings))
Embeddings\GeneratedEmbeddingsTests.cs (3)
19Assert.Throws<ArgumentNullException>("embeddings", () => new GeneratedEmbeddings<Embedding<float>>(null!)); 20Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new GeneratedEmbeddings<Embedding<float>>(-1)); 63var generatedEmbeddings = new GeneratedEmbeddings<Embedding<float>>(embeddings);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceEmbeddingGenerator.cs (1)
92GeneratedEmbeddings<Embedding<float>> result = new(embeddings.Data.Select(e =>
Microsoft.Extensions.AI.Integration.Tests (2)
QuantizationEmbeddingGenerator.cs (2)
40return new(from e in embeddings select QuantizeToBinary(e)) 73return new(from e in embeddings select QuantizeToHalf(e))
Microsoft.Extensions.AI.OpenAI (1)
OpenAIEmbeddingGenerator.cs (1)
118return new(embeddings.Select(e =>
Microsoft.Extensions.AI.Tests (3)
Embeddings\LoggingEmbeddingGeneratorTests.cs (1)
39return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>([new Embedding<float>(new float[] { 1f, 2f, 3f })]));
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (2)
25null!, (values, options, innerGenerator, cancellationToken) => Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(Array.Empty<Embedding<float>>())))); 34GeneratedEmbeddings<Embedding<float>> expectedEmbeddings = new();
57 references to GeneratedEmbeddings
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
221private Task<GeneratedEmbeddings<Embedding<float>>> TestMiddleware(IEnumerable<string> inputs, EmbeddingGenerationOptions? options, IEmbeddingGenerator<string, Embedding<float>> nextAsync, CancellationToken cancellationToken)
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
222private Task<GeneratedEmbeddings<Embedding<float>>> TestMiddleware(IEnumerable<string> inputs, EmbeddingGenerationOptions? options, IEmbeddingGenerator<string, Embedding<float>> nextAsync, CancellationToken cancellationToken)
Microsoft.Extensions.AI (14)
Embeddings\AnonymousDelegatingEmbeddingGenerator.cs (3)
19private readonly Func<IEnumerable<TInput>, EmbeddingGenerationOptions?, IEmbeddingGenerator<TInput, TEmbedding>, CancellationToken, Task<GeneratedEmbeddings<TEmbedding>>> _generateFunc; 28Func<IEnumerable<TInput>, EmbeddingGenerationOptions?, IEmbeddingGenerator<TInput, TEmbedding>, CancellationToken, Task<GeneratedEmbeddings<TEmbedding>>> generateFunc) 37public override async Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(
Embeddings\CachingEmbeddingGenerator.cs (4)
28public override async Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync( 51var generated = await base.GenerateAsync(valuesList, options, cancellationToken).ConfigureAwait(false); 66GeneratedEmbeddings<TEmbedding> results = []; 90var uncachedResults = await base.GenerateAsync(uncached.Select(e => e.Input), options, cancellationToken).ConfigureAwait(false);
Embeddings\ConfigureOptionsEmbeddingGenerator.cs (1)
44public override async Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(
Embeddings\EmbeddingGeneratorBuilder.cs (1)
99Func<IEnumerable<TInput>, EmbeddingGenerationOptions?, IEmbeddingGenerator<TInput, TEmbedding>, CancellationToken, Task<GeneratedEmbeddings<TEmbedding>>>? generateFunc)
Embeddings\LoggingEmbeddingGenerator.cs (2)
49public override async Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(IEnumerable<TInput> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default) 65var embeddings = await base.GenerateAsync(values, options, cancellationToken).ConfigureAwait(false);
Embeddings\OpenTelemetryEmbeddingGenerator.cs (3)
81public override async Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(IEnumerable<TInput> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default) 89GeneratedEmbeddings<TEmbedding>? response = null; 161GeneratedEmbeddings<TEmbedding>? embeddings,
Microsoft.Extensions.AI.Abstractions (7)
Embeddings\DelegatingEmbeddingGenerator.cs (1)
58public virtual Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(IEnumerable<TInput> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default) =>
Embeddings\EmbeddingGeneratorExtensions.cs (2)
90/// resulting <see cref="GeneratedEmbeddings{TEmbedding}"/> collection. 146var embeddings = await generator.GenerateAsync(values, options, cancellationToken).ConfigureAwait(false);
Embeddings\GeneratedEmbeddings.cs (3)
20/// <summary>Initializes a new instance of the <see cref="GeneratedEmbeddings{TEmbedding}"/> class.</summary> 26/// <summary>Initializes a new instance of the <see cref="GeneratedEmbeddings{TEmbedding}"/> class with the specified capacity.</summary> 34/// Initializes a new instance of the <see cref="GeneratedEmbeddings{TEmbedding}"/> class that contains all of the embeddings from the specified collection.
Embeddings\IEmbeddingGenerator.cs (1)
35Task<GeneratedEmbeddings<TEmbedding>> GenerateAsync(
Microsoft.Extensions.AI.Abstractions.Tests (17)
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
36var expectedResult = new TaskCompletionSource<GeneratedEmbeddings<Embedding<float>>>();
Embeddings\EmbeddingGeneratorExtensionsTests.cs (2)
36Task.FromResult<GeneratedEmbeddings<Embedding<float>>>([result]) 58Task.FromResult<GeneratedEmbeddings<Embedding<float>>>(new(embeddings))
Embeddings\GeneratedEmbeddingsTests.cs (12)
26GeneratedEmbeddings<Embedding<float>>[] instances = 34foreach (var instance in instances) 63var generatedEmbeddings = new GeneratedEmbeddings<Embedding<float>>(embeddings); 94GeneratedEmbeddings<Embedding<float>> embeddings = []; 115GeneratedEmbeddings<Embedding<float>> embeddings = []; 126GeneratedEmbeddings<Embedding<float>> embeddings = []; 141GeneratedEmbeddings<Embedding<float>> embeddings = []; 157GeneratedEmbeddings<Embedding<float>> embeddings = []; 180GeneratedEmbeddings<Embedding<float>> embeddings = []; 199GeneratedEmbeddings<Embedding<float>> embeddings = []; 217GeneratedEmbeddings<Embedding<float>> embeddings = []; 235GeneratedEmbeddings<Embedding<float>> embeddings = [];
TestEmbeddingGenerator.cs (2)
15public Func<IEnumerable<string>, EmbeddingGenerationOptions?, CancellationToken, Task<GeneratedEmbeddings<Embedding<float>>>>? GenerateAsyncCallback { get; set; } 19public Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync(IEnumerable<string> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceEmbeddingGenerator.cs (2)
85public async Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync( 92GeneratedEmbeddings<Embedding<float>> result = new(embeddings.Data.Select(e =>
Microsoft.Extensions.AI.Integration.Tests (5)
CallCountingEmbeddingGenerator.cs (1)
20public override Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync(
QuantizationEmbeddingGenerator.cs (4)
36async Task<GeneratedEmbeddings<BinaryEmbedding>> IEmbeddingGenerator<string, BinaryEmbedding>.GenerateAsync( 39var embeddings = await _floatService.GenerateAsync(values, options, cancellationToken).ConfigureAwait(false); 69async Task<GeneratedEmbeddings<Embedding<Half>>> IEmbeddingGenerator<string, Embedding<Half>>.GenerateAsync( 72var embeddings = await _floatService.GenerateAsync(values, options, cancellationToken).ConfigureAwait(false);
Microsoft.Extensions.AI.Ollama (1)
OllamaEmbeddingGenerator.cs (1)
79public async Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync(
Microsoft.Extensions.AI.OpenAI (1)
OpenAIEmbeddingGenerator.cs (1)
112public async Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync(IEnumerable<string> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.Extensions.AI.Tests (8)
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
35GeneratedEmbeddings<Embedding<float>> expectedEmbeddings = [];
Embeddings\DistributedCachingEmbeddingGeneratorTest.cs (1)
37return Task.FromResult<GeneratedEmbeddings<Embedding<float>>>([_expectedEmbedding]);
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (4)
21builder.Use((Func<IEnumerable<string>, EmbeddingGenerationOptions?, IEmbeddingGenerator<string, Embedding<float>>, CancellationToken, Task<GeneratedEmbeddings<Embedding<float>>>>)null!)); 34GeneratedEmbeddings<Embedding<float>> expectedEmbeddings = new(); 59var e = await innerGenerator.GenerateAsync(values, options, cancellationToken); 67GeneratedEmbeddings<Embedding<float>> actual = await generator.GenerateAsync(expectedValues, expectedOptions, expectedCts.Token);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestEmbeddingGenerator.cs (2)
15public Func<IEnumerable<string>, EmbeddingGenerationOptions?, CancellationToken, Task<GeneratedEmbeddings<Embedding<float>>>>? GenerateAsyncCallback { get; set; } 19public Task<GeneratedEmbeddings<Embedding<float>>> GenerateAsync(IEnumerable<string> values, EmbeddingGenerationOptions? options = null, CancellationToken cancellationToken = default)