Hi There,
I need to convert LLM output to full sentences . the format below , how can I parse ?
Many Thanks,
Jack
___________________________________
data:{"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"用户"}}]}
data: {"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"的需求"}}]}
data: {"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"是作为一个"}}]}
data: {"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"项目文档审核专家,根据"}}]}
data: {"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"提供的审核规则清单对"}}]}
data: {"id":"20260826212233d21d32ac80d84db2","created":1787750553,"object":"chat.completion.chunk","model":"glm-5.2","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"给定的Markdown格式文档进行审核"}}]}
Hi @Jack Bao ,
I assume you use an API for this and not an agentic implementation in ODC.
You could split the response into separate lines, remove the data: prefix, deserialize each JSON object, and then transform the extracted values into the format you need.
However, these appear to be streaming response chunks. Are you sure you need to process the streamed messages individually? It would also be helpful to know exactly what information you want to extract from the response.
Hi @Jack Bao,
If you are talking about ODC, you can use Agent Workbench to achieve this. Basically, the data you provide can be used as grounding data, similar to a RAG-based approach, depending on how you configure your agent.
The flow generally works like this:
You can also check these resources for more details:
Hi @Jack Bao ,Another approach is to use the LLM to do the heavy lifting fo you.You can just take that entire raw text block and pass it into another LLM action. Just give it a simple system prompt like "Extract the reasoning content from this raw data stream and output it as a single, readable sentence."The model will easily ignore all the JSON formatting and will spit out a clean text you need. It is a bit of a shortcut, but it works perfectly if you just want to get straight to the final readable text.