Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve EmbeddingGeneratorExtensions #5551

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Oct 22, 2024

@SteveSandersonMS, @eiriktsarpalis, @luisquintanilla, this is related to our discussion this morning.

We end up with:

  • The interface method GenerateAsync that returns GeneratedEmbeddings
  • GenerateEmbeddingAsync that returns a TEmbedding
  • GenerateEmbeddingVectorAsync that returns a ReadOnlyMemory<T>
  • GenerateAndZipEmbeddingsAsync that returns a List<KVP<TInput, TEmbedding>>
Microsoft Reviewers: Open in CodeFlow

Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

- Renames GenerateAsync extension method (not the interface method) to be GenerateEmbeddingAsync, since it produces a single TEmbedding
- Adds GenerateEmbeddingVectorAsync, which returns a `ReadOnlyMemory<T>`
- Adds a GenerateAndZipEmbeddingsAsync, which creates a `List<KeyValuePair<TInput, TEmbedding>>` that pairs the inputs with the outputs.
@stephentoub stephentoub merged commit 479b67e into dotnet:main Oct 23, 2024
6 checks passed
@stephentoub stephentoub deleted the embeddingextensions branch October 23, 2024 21:52
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants