ragflow
ragflow copied to clipboard
[Feature Request]: References / Citations missing when using RagFlow OpenAI endpoint
Self Checks
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (Language Policy).
- [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
- [x] Please do not modify this template :) and fill in all the required fields.
Is your feature request related to a problem?
Environment
RagFlow server infiniflow/ragflow:v0.19.0 (public “full” image)
ragflow-sdk 0.19.0 (also tested main)
Problem
Chat completions work, but citations never appear when using RagFlow OpenAI endpoint
(raw text shows {{source:n}}, no blue ℹ️ hover).
Direct HTTP curl to /api/v1/openai/chat/completions with
with_reference=true returns:
json
Copy
Edit
{"code":100,"data":null,"message":"<NotFound '404: Not Found'>"}
→ the reference block is missing.
Inside Python, SDK v0.19.0 likewise gives ans.reference == []
unless show_quote=True, and even then streaming calls drop
reference.
Root cause (per #8269 discussion)
Backend – the streaming handler in
ragflow/api/db/services/dialog_service.py never copies kbinfos
(quote context) into the final chunk, so the REST payload the SDK
parses lacks reference.
SDK – older 0.19.0 wheel sets show_quote=False by default and
doesn’t copy backend reference into its own response object.
Describe the feature you'd like
Could the maintainers merge an official fix that always includes reference (a.k.a. kbinfos) in the final streaming chunk, and surfaces that field in the Python SDK response (both stream and non-stream)?
Alternatively, document the correct env/flag combination for public images so OpenAI + Context API works out-of-the-box.
Thanks!
Describe implementation you've considered
No response
Documentation, adoption, use case
Additional information
No response
@yongtenglei for review
I am having the same issue.
me same
https://ragflow.io/docs/dev/python_api_reference#examples
Citations are now in reference.
completion = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who are you?"},
{"role": "assistant", "content": "I am an AI assistant named..."},
{"role": "user", "content": "Can you tell me how to install neovim"},
],
stream=stream,
extra_body={"reference": reference}
)