-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feat(graphql): Add vector support to graphql #9074
Conversation
…ch based on vector indexes (#48) - [Float] data type with an @Embedding directive in GraphQL is mapped to "VFLOAT" data type in dgraph - @Embedding directive is allowed only for [Float] data type - Add querySimilar<Type> query that performs similarity search based on HNSW (vector) indexes for types with fields having @Embedding directive - querySimilar<Type> accepts 3 arguments 1. id - unique id for the object to run similarity search on. 2. <predicate> - An enum of embedding predicates defined in the type to base the search on 3. <topK> - number of nearest neighbors to return
…62) Description: If topK argument in querySimilar* queries is a graphql variable dgraph reported a panic as topK was explicitly cast as int. The fix instead uses fmt.Sprintf("%v", topK) where topK is of type interface{}. This works for when topK is passed as an int literal or a graphql variable. Fixes: HYP-328
… searches (#60) Description: If the vector parameter in a similar_to function call is a variable that evaluates to NULL then we report it as a parsing (syntax) error. The fix, instead of reporting a parsing error, returns an empty result. Closes: HYP-302 --------- Co-authored-by: Bill Province <[email protected]>
Description: Made the embedding parameeter, by, to be NonNull for `querySimilar<Type>ById `& `querySimilar<Type>ByEmbedding ` queries. This fixes the backend panic. However, the postman client fails to show the dropdown as in the input for the parameter. It shows it as a simple text input box. The client, while editing the query text in the editor pane shows valid enum values as part of the autocomplete feature. Fixes: HYP-336
…69) Description: This PR adds support for specifying @search directive with search options (vector index options) The fix is not backward compatible. Earlier searchArgs in @search directive were expected to be Enum of index types. Arguments are expected to be strings now of the following form. `@search(by: [String!])` where each string element in the array is of the form `<searchArg> := <searchType> [ ( <searchOptions> ) ]` searchOptions are optional. ``` ``` <searchOptions> := <searchOption> , <searchOption>, ... <searchOption> := <optionName><COLON><SPACE><optionValue> ``` ``` For example: `product_vector: [Float!] @hm_embedding @search(by: ["hnsw(metric: euclidian, exponent: 6)"])` Fixes: HYP-313
…_distance field was getting clobbered (#77) Description: ``` querySimilar<Type> queries defined a new derived type "<Type>WithDistance" with a new field hm_distance. However, if <Type> had any lists, hm_distance was getting clobbered by an "<ListFieldName>Aggregate" being added to <Type> The fix essentially does away with the derived type <Type>WithDistance as the resultType for querySimilar<Type> queries. Instead, we add <embeddingFieldName>Distance field for each embedding in the <Type> definition itself. This would make it easy to add support for filters on embeddings. ``` Fixes: HYP-447
…ch-filter (#79) This change adds filter agrument to querySimilarById & querySimilarByEmbedding queries. The filter argument is used as a "post-vector-serach-filter" to filter out nodes returned by the vector search. Fixes: HYP-334
…#82) Description: Computes hm_distance based on the HNSW index metric ('euclidian', 'dotproduct', 'cosine') Euclidian - (v1 - v2) dot (v1 - v2) Dot product - v1 dot v2 Cosine - (v1 dot v2) / ((v1 dot v1) * (v2 dot v2)) Fixes: HYP-477
|
|
@harshil-goel Defining a field in graphql type as the bellow doesn't work: embedding: [Float!] @embedding @search(by: ["hnsw(exponent: 4, metric: euclidian)"])
|
Adds support for vector predicate in GraphQL. Introduced new queries like similar_to() in graphql