Hi everyone, Im getting
AttributeError: 'Response' object has no attribute 'response_gen'
for this code:
In service:
...
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:
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. 🙏