Skip to content
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

Cannot get generative search results and object ID together #107

Open
itsajchan opened this issue Jan 18, 2024 · 2 comments
Open

Cannot get generative search results and object ID together #107

itsajchan opened this issue Jan 18, 2024 · 2 comments

Comments

@itsajchan
Copy link

itsajchan commented Jan 18, 2024

When making a generative search query and requesting the id in the latest ts client (2.0.0) available on NPM, it's not possible to get both the ID and a generated singleResult together in a single query.

So the following doesn't work:

   const result = await client.graphql
        .get()
        .withClassName('Question')
        .withFields('name answer _additional { id}')
        .withGenerate({singlePrompt: 'Explain {answer} as you might to a five-year-old.'})
        .withLimit(1)
        .do();

This work around appears to work but doesn't align with the expected developer experience:

   const generatePrompt = 'Explain {answer} as you might to a five-year-old.'
    const result = await client.graphql
        .get()
        .withClassName('Question')
        .withFields(`name answer { id generate ( singleResult: { prompt:\"${generatePrompt}\"}){error singleResult } }`)
        .withLimit(1)
        .do();

Which produces the desired output of the generated result and the id together.

@larryhudson
Copy link

larryhudson commented Feb 10, 2024

Hi there, I'm dealing with this same issue. Thanks for posting the workaround - I can confirm that's working for me, but would be good to get this bug fixed.

I've made a minimal repo reproducing this issue here:
https://github.com/larryhudson/astro-weaviate-generative-id-troubleshooting

I've also asked about this in the Weaviate Slack support channel but haven't got an answer yet.

@larryhudson
Copy link

This is still an issue, I just ran into it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants