Using cross-reference properties with generative search

I am trying to use generative modules with cross-referenced documents and am having trouble figuring out how to properly reference the properties of the cross-reference to include them in the generate task.

The use case boils down to:

  • I have chunked documents; schema is basically a one to many relationship between ParentDoc and DocChunks
  • I need to grab the limit: 1 matching DocChunk of a nearText query
  • I need to use the groupedResult generator with all of the DocChunks that relate to the ParentDoc of my matching DocChunk, in effect the entire text of the ParentDoc - all DocChunks put together

Using the online demo (https://edu-demo.weaviate.network/v1) a basic query that I am trying to run could be modeled as follows:

{
  Get {
    Article(
      limit: 1
      where: {operator: Equal, path: ["hasAuthors", "Author", "name"], valueString: "Benjamin Lee"}
    ) {
      _additional {
        id
        certainty
        generate(
          groupedResult: {task: """reply with the exact input i provided""", properties: ["name"]}
        ) {
          error
          groupedResult
        }
      }
      title
      url
      summary
      hasAuthors {
        ... on Author {
          name
        }
      }
    }
  }
}

Where I attempt to pass the name property of the cross-referenced Author class into the generator. I have tried a variety of syntax but have not been successful. Is this a supported feature? If so, can you please help me sort out my query?

Hi @felixthekraut - Have you tried passing the property as

["hasAuthors { ... on Author { name }"]

rather than ["name"]?

If you only specify “name” that would imply that you want to pass the “name” property of the “Article” object. I think that should work but please let me know.

I had not tried that, thank you for the suggestion! I just gave it a try and while I don’t receive an error, I don’t receive any results either.

["hasAuthors { ... on Author { name }"] provides the same results as ["asdf"]:

                    "_additional": {
                        "generate": {
                            "error": null,
                            "groupedResult": "[{}]"
                        }
                    }

Other permutations I have tried are ["hasAuthors", "Author", "name"] and ["hasAuthors.Author.name"].

Hmm. Let me check with the team and get back to you.

Hi, so I’m informed that currently, you can’t pass cross-referenced object properties through the generative module.

It might be added in the future, depending on user needs and requests. Sorry I didn’t know that!

Thanks for the info. Do you know if there is already a feature request that I can upvote/add detail to? I couldn’t find one, and am happy to create one.

As far as I understand if I were to add an array of text[] and vectorize it, this would result in a single vector instead of one per array member, is that correct? I am trying to think of some workarounds short of running many sequential queries.

I’m not aware of the particular feature request.

And yes, you will get one one vector in the proposed scenario - in Weaviate you get one vector per object. This is a feature that may change in the future although not definite.

I logged https://github.com/weaviate/weaviate/issues/3127 outlining a sample use case.