-
If I do chat per API, I get the message content with citations like: ##0$$, ##1$$, ##2$$ ... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The numbers in the citations like ##0$$, ##1$$, ##2$$ in the API response are placeholders that point to specific source chunks retrieved by RAGFlow. Each number corresponds to an entry in the reference data returned by the API—typically in a field called reference.chunks or reference.doc_aggs. These chunks contain metadata about the source, such as document name, content, and other details. So, ##0$$ means "this part of the answer is supported by the first chunk in the reference list," ##1$$ by the second, and so on example example. To show the actual citation details to your users, extract the citation numbers from the answer text, then look up the corresponding entry in the reference.chunks array in the same API response. For example, if you see ##2$$ in the answer, display the metadata from reference.chunks[2] as the citation. If your API response does not include the reference field, you may need to adjust your API call or backend to include it details. If you want to remove the ##0$$-style markers from the answer text, you can use a regular expression like Let me know if you need a code example for extracting and displaying the citations! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
actually I shall use API "Converse with chat assistant": /api/v1/chats/{chat_id}/completions
instead of "Create chat completion", which use api: /api/v1/chats_openai/{chat_id}/chat/completions
Use the first API, the references are in json response.