Find answers from the community

Home
Members
Renzo Quispe
R
Renzo Quispe
Offline, last seen 3 months ago
Joined September 25, 2024
Hi everyone, Im getting AttributeError: 'Response' object has no attribute 'response_gen' for this code:

In service:

Plain Text
        ...
        llm = OpenAI(
            model=request.model.value,
            temperature=request.temperature,
            max_tokens=NUM_OUTPUTS,
        )

        service_context = ServiceContext.from_defaults(llm=llm)

        query_engine = index.as_query_engine(
            streaming=True,
            service_context=service_context,
            similarity_top_k=1,
        )

        response_stream = query_engine.query(input_text)
        def _stream_chat(generator):
            for chunk in generator:
                yield chunk

        return _stream_chat(response_stream.response_gen)


Im calling that service from:
Plain Text
        return StreamingResponse(
            content=IDPService().query(body),
            status_code=status.HTTP_200_OK,
            media_type="text/html",
        )


Any Ideas? Im following documentation for return StreamingResponse for frontend/user. 🙏
1 comment
L