Skip to content

Conversation

@adamsitnik
Copy link
Member

fixes #10193

@adamsitnik adamsitnik requested a review from a team as a code owner April 4, 2025 11:10
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel memory labels Apr 4, 2025
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

LGTM thanks Adam! My only comment is about adding an overload without the options (see below), but that can be done later (with our current rhythm, better to merge quickly).


// Search for similar prompts in cache.
var searchResults = await collection.VectorizedSearchAsync(promptEmbedding, new() { Top = 1 }, context.CancellationToken);
var searchResults = await collection.VectorizedSearchAsync(promptEmbedding, top: 1, cancellationToken: context.CancellationToken);
Copy link
Member

Choose a reason for hiding this comment

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

It's (slightly) annoying to have to specify the cancellationToken named argument just because we don't need to specify the options :/

Should we add an overload that doesn't accept the options, and have a default interface implementation - for .NET 8.0 only - that calls into the main one? We should try to not let the .NET Framework support cause an inferior dev experience to people using modern .NET...

@westey-m @adamsitnik what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would ask a question during API review about what is the recommended approach to tackle this particular problem (I agree it's annoying).

Copy link
Member

Choose a reason for hiding this comment

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

Opened #11382.

var vectorizedQuery = await this._textEmbeddingGeneration!.GenerateEmbeddingAsync(query, cancellationToken: cancellationToken).ConfigureAwait(false);

return await this._vectorizedSearch.VectorizedSearchAsync(vectorizedQuery, vectorSearchOptions, cancellationToken).ConfigureAwait(false);
return await this._vectorizedSearch.VectorizedSearchAsync(vectorizedQuery, searchOptions.Top, vectorSearchOptions, cancellationToken).ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

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

We should consider applying the same decision (make Top a mandatory parameter) for ITextSearch - the same logic applies (/cc @markwallace-microsoft)

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch, but IMO we need a separate PR for that (it's used in plenty of spaces, I am not sure how to run all related tests to ensure I dont break anything).

Copy link
Member

Choose a reason for hiding this comment

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

@adamsitnik absolutely, opened #11381.

@adamsitnik adamsitnik merged commit f703f69 into microsoft:feature-vector-data-preb2 Apr 4, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel memory .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants