Judging by the reactions, many people would appreciate to get context chunks used for final generation step in RAG via API. I believe this should be pretty much standard in any production system.
Context chunks are used not only for a reference, but also for any response evaluations based on RAGAS, DeepEval or others...
Originally created by @vaclcer on GitHub (May 22, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14164
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
### Problem Description
Hi, this is a recurring topic [13304](https://github.com/open-webui/open-webui/discussions/13304)
Judging by the reactions, many people would appreciate to get context chunks used for final generation step in RAG via API. I believe this should be pretty much standard in any production system.
Context chunks are used not only for a reference, but also for any response evaluations based on RAGAS, DeepEval or others...
There was a rejected PR addressing this [13378](https://github.com/open-webui/open-webui/pull/13378)
This might be working with enabled streaming response, but that is not trivial to process for many of us, I presume.
Thank you for the consideration!
### Desired Solution you'd like
I would think retrieving RAG context/chunks would be configurable via /api/chat/completions payload object, similar as:
> payload = {
> 'model': model,
> 'messages': [{'role': 'user', 'content': query}],
> 'files': [{'type': 'collection', 'id': collection_id}]
> 'retrieve_context': True
> }
### Alternatives Considered
_No response_
### Additional Context
_No response_
This would be so nice to have, making the api finally capable to return the knowledge
<!-- gh-comment-id:2900478523 -->
@daschuchmann commented on GitHub (May 22, 2025):
This would be so nice to have, making the api finally capable to return the knowledge
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @vaclcer on GitHub (May 22, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14164
Check Existing Issues
Problem Description
Hi, this is a recurring topic 13304
Judging by the reactions, many people would appreciate to get context chunks used for final generation step in RAG via API. I believe this should be pretty much standard in any production system.
Context chunks are used not only for a reference, but also for any response evaluations based on RAGAS, DeepEval or others...
There was a rejected PR addressing this 13378
This might be working with enabled streaming response, but that is not trivial to process for many of us, I presume.
Thank you for the consideration!
Desired Solution you'd like
I would think retrieving RAG context/chunks would be configurable via /api/chat/completions payload object, similar as:
Alternatives Considered
No response
Additional Context
No response
@daschuchmann commented on GitHub (May 22, 2025):
This would be so nice to have, making the api finally capable to return the knowledge
@tjbck commented on GitHub (May 26, 2025):
Addressed with
2d5b82df8c.