Find answers from the community

Updated 2 months ago

Hey I am trying to use doc ids filter in

Hey, I am trying to use doc_ids filter in Weaviate vector store by doing this
Plain Text
query_engine = self.index.as_query_engine(
            service_context=self.service_context,
            text_qa_template=qa_template_copy, 
            refine_template=refine_template_prompt,
            streaming=streaming,
            similarity_top_k=3, 
            doc_ids=doc_ids,
            verbose=True,
        )

But I get the following error
Plain Text
'Response' object has no attribute 'response_gen'

Does any one know how what is causing this error?
Thanks!
T
m
L
14 comments
How are you trying to access the response object?
this is what I am doing
Plain Text
def generate_response_stream(response_gen):
    """Yield the response stream."""
    # stream json data
    for text in response_gen:
        yield text
return Response(generate_response_stream(data.response_gen), mimetype='text/json')
It works fine when I remove the doc_ids filter
Yeah I don't think you can pass that in the query engine like that, do you have more details on your implementation of doc_id?
doc_ids is basically an array of strings which I pass in the body of the post request.
Is streaming actually set to true? What kind of LLM are you using?
Yup streaming is set to True and I am using opean ai's gpt-3.5-turbo model.
Are you using langchains LLM object or the one from LlamaIndex?
I am using the one from LlamaIndex
Plain Text
from llama_index.llms import OpenAI
Streaming should be working then, not sure what's up there πŸ˜…
It works on my end πŸ€”
Ah yes it was on my side indeed πŸ˜…
I was trying to pass in a document_id which did not exist in that index.
ah gotcha, good catch!
Add a reply
Sign up and join the conversation on Discord