-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor vector search API with flexible syntax and enhanced type safety #262
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
Open
mpartipilo
wants to merge
19
commits into
main
Choose a base branch
from
feat/improved-multi-target-vector-input
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
…capabilities - Updated `BaseAggregateRequest` to streamline NearText and NearVector handling by introducing helper methods. - Enhanced `ToGrpcTargets` to differentiate between simple and weighted target vectors. - Simplified vector deserialization in `Result` class. - Refactored `BuildTargetVector` to support NamedVector and VectorSearchInput, improving target vector creation logic. - Modified `Search` methods to accept VectorSearchInput, consolidating vector and target configurations. - Improved hybrid search handling by integrating vector search input and refining target vector logic. - Ensured consistent handling of target vectors across various search types, including NearText and NearVector.
d238cbd to
aa9ce0f
Compare
Summary - Weaviate C# Client CoverageSummary
CoverageWeaviate.Client - 58.4%
Weaviate.Client.Analyzers - 0%
|
- Updated various methods in AggregateClient, GenerateClient, and QueryClient to replace Func<TargetVectorsBuilder, TargetVectors> with TargetVectors.FactoryFn for improved clarity and usability. - Introduced a new Builder class for TargetVectors to facilitate the creation of target vectors using a more intuitive lambda syntax. - Enhanced VectorSearchInput to support implicit conversion from FactoryFn, allowing for seamless integration with the new builder pattern. - Added extension methods for hybrid search in GenerateClient and QueryClient, enabling the use of lambda expressions for vector creation. - Removed the obsolete TargetVectorsBuilder class to streamline the codebase and reduce complexity.
…improve readability
…uce FactoryFn for streamlined vector input creation
…ative capabilities - Added optional generative provider parameter to various methods in TypedGenerateClient for enriching prompts. - Introduced after cursor for pagination in FetchObjects methods across TypedGenerateClient and TypedQueryClient. - Implemented hybrid search methods in TypedQueryClient to support keyword and vector searches with grouping. - Enhanced NearVector methods in TypedQueryClient to utilize lambda functions for vector building. - Updated documentation to reflect new parameters and functionalities.
…, and enhance documentation - Consolidated NearText API overloads across QueryClient, GenerateClient, AggregateClient, and Typed clients. - Introduced convenience overloads for text-only Hybrid search and NearText target vectors. - Updated method signatures to accept TargetVectors directly instead of using FactoryFn. - Enhanced documentation for NearText methods, including examples for new usage patterns. - Added extension methods for NearText search with lambda target vector builders in Typed clients. - Updated tests to validate new NearText functionality with multiple target vectors.
- Introduced new methods for searching near vectors using NearVectorInput records in TypedGenerateClient. - Added overloads for NearVector methods to support lambda builders for NearVectorInput. - Updated TypedQueryClient to handle HybridVectorInput and improve hybrid search functionality. - Refactored NearText methods to utilize NearTextInput records and support lambda builders. - Improved documentation for new and existing methods to clarify usage and parameters.
…istency in API documentation
…ttern, remove deprecated NearImage methods, and enhance documentation with examples. Update tests to validate new syntax and ensure consistent request generation across media types.
… for improved syntax consistency
…rVector inputs, enhancing documentation
…mprove documentation
…y and consistency
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR significantly enhances the vector search API by introducing flexible syntax patterns, comprehensive builder interfaces, and improved type safety for multi-target vector operations.
Key Improvements
1. Flexible Vector Input Syntax 🎯
Introduced multiple ways to specify vectors in searches, supporting various coding styles:
2. Multi-Target Vector Combinations 🔄
Added support for multiple combination strategies:
3. Hybrid Search Enhancements 🔀
Simplified hybrid search with flexible input options:
4. Improved Type Safety ✨
float[]toVectortypefloat[],double[],int[], etc.)5. Comprehensive Test Coverage 🧪
Added 126 new unit tests covering all syntax patterns:
All tests validate request structure and ensure API consistency.
6. Enhanced Mock Infrastructure 🔧
CreateWithSearchCapture()for capturing Search requestsCreateWithAggregateCapture()for capturing Aggregate requestsAPI Changes
Builder Interfaces
INearVectorBuilder:
IHybridNearVectorBuilder: (same methods for hybrid searches)
Backward Compatibility
✅ All existing code continues to work unchanged
✅ 1017 tests passing (0 failures)
✅
Vectorimplicit conversions maintain compatibility withfloat[]anddouble[]Documentation
VECTOR_API_OVERVIEW.mdwith comprehensive examplesTesting
Files Changed
VectorInputBuilders.cs- Builder interfaces and implementationsVectorSearchInput.cs- Core vector search typesQueryClient.*.cs- Query method overloadsGenerateClient.*.cs- Generate method overloadsAggregateClient.*.cs- Aggregate method overloadsHybridVectorInput.cs- Hybrid search input types