Hi everyone! Has anyone managed to get
source_nodes
before the response is generated in the
streaming
cases?
sec-insight
is doing something similar by showing the SubQuery questions before the response is generated but the code is way too complex for my understanding (using anyio and different channels for each process). I was wondering if there's a simpler way?
I tried with something like this but doesn't work :/
streaming_response = chat_engine.stream_chat(last_message.content)
message = {
"type": "sources",
"data": [str(i) for i in streaming_response.source_nodes],
}
yield "Context received, before LLM call: " + str(time.time())
yield "\n\n"
for token in streaming_response.response_gen:
yield token
Using it for streaming in FastAPI backend.