Hey there, I've got hopefully an easy question: I'm trying to add langfuse tracing to my retriever and also stream the response. I've got something like:
@observe()
async def query():
(...)
with instrumentor.observe(
session_id=session_id,
) as trace:
retriever = RAGRetriever()
retriever_result = await retriever.run(
query="(my query)",
index=retriever_index,
)
async for chunk in retriever_result.async_response_gen():
print(chunk, end="", flush=True)
instrumentor.flush()
if __name__ == "__main__":
import asyncio
asyncio.run(query())
The issue I'm having is my script never exits. If I remove the
instrumentor.observe()
wrapper it streams my response and exits as I expect. What am I missing?