When streaming with OpenAI Assistants openai.beta.threads.messages.create( thread_id=thread_id, role="user", content=payload.question ) run = openai.beta.threads.runs.create( thread_id=thread_id, assistant_id=assistant_id, stream=True, tool_choice={"type": "file_search"}, ) streamed_text = "" for event in run: if event.event == "thread.message.delta": delta_content = event.data.delta.content if delta_content and delta_content[0].type == "text": text_fragment = delta_content[0].text.value streamed_text += text_fragment yield {"data": text_fragment} if event.event == "thread.run.completed": break the citations are coming in the formats like 【4:2†source】 or citeturnXfileY How to fix it? Continue reading...