weaviate-python-client icon indicating copy to clipboard operation
weaviate-python-client copied to clipboard

Support group operator

Open byronvoorbach opened this issue 1 year ago • 1 comments

Currently, the V4 client does not support the group parameter natively, as described here:

https://weaviate.io/developers/weaviate/api/graphql/additional-operators#grouping

import os
import weaviate
import weaviate.classes as wvc
from weaviate.collections.classes.grpc import Sort

client = weaviate.connect_to_local()

try:
    article=client.graphql_raw_query(
    """
    {
        Get {
        Publication(
            group:{
            type: merge,
            force:0.05
            }
        ) {
            name
        }
        }
    }
    """
    )

    for a in article.get["Publication"]:
        print(a)

finally:
    client.close()

Would be great if we could support this, as customers use this for deduplication of similar type of results

byronvoorbach avatar Feb 22 '24 17:02 byronvoorbach

I had a quick look and this is a bit more complex than I thought, because the returns are different then what we normally expect.

Here is a weaviate PR for the input: https://github.com/weaviate/weaviate/pull/4355 but parsing the returns is missing and a python client branch grouping that also has only the input part covered

dirkkul avatar Feb 29 '24 12:02 dirkkul