Chat in the knowleadge base gives the source files, but the python code does not provide the source files #11778
Replies: 2 comments 2 replies
-
|
Hi @Arun-Arcadix! I'm Dosu and I’m helping the ragflow team. The reason you aren't seeing source file references in your Python code is that the OpenAI-compatible endpoint expects the parameter to be named reference (not show_ref_docs) to include source references in the response. Update your code to use extra_body={"reference": True} in your chat completion request. When enabled, the references will appear in choices[0].message.reference in the response for non-streaming mode (source). If you still don't see references after this change, there is a known issue where the backend or SDK may omit them. Fixes involve backend and SDK updates to ensure the reference field is included in the response (details and code pointers). After updating, restart your service and make sure the quote parameter is set to true in your assistant config. Once working, you can extract file paths or document names from the reference field in the response. If your knowledge base indexing includes file paths as metadata, they will be present in the reference data. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
try what dosu said. If you still cannot view the reference, then you might have to raise a feature request for this issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Team,
This is my chat response from the knowledge base.
But I do the chat completion using the below code, I am not getting the source files.
This is my raw_completion_data, Please help.
{'choices': [{'finish_reason': 'stop', 'index': 0, 'logprobs': None, 'message': {'annotations': None, 'audio': None, 'content': 'The knowledge base contains information about the
PopupFramecomponent, which is a React component used in the Arcadix framework. Here's a summary of its functionality and structure:ID: 0
PopupFramecomponent serves as a container or frame for displaying popup content within the Arcadix application. It handles the positioning, sizing, and basic UI elements (like maximize and close buttons) for the popup.useReducerhook to manage the component's state, including properties like height, width, position (left, top), and maximization status.PopupFrame_Hook.GetInitialState(props).OnMouseDown,OnMouseMove, andOnMouseUpevent handlers to manage the dragging behavior.isClickedattribute on the frame is used to determine if a drag is in progress.ToggleMaximizefunction to switch the popup between a maximized (100% height and width) and a normal size.PopupComponentControllerto load the actual content of the popup dynamically.useLayoutEffecthook is used to load the popup component and get its dimensions.ID: 1
div className="modal")div className="popup-innner-modal")div className="popup-header") with:props.Data.PopupData.Meta.ShowHeaderis true)PopupComponentcomponent.onMouseDown,onMouseUp,onTouchStart, andonTouchEndhandlers for dragging.onClickhandler that calls theClosePopupevent.React.memoto prevent unnecessary re-renders. It checks if theIdprop has changed to determine if a re-render is needed.In summary,
PopupFrameis a reusable component that provides the basic structure and functionality for displaying dynamic popup content in the Arcadix framework. It handles positioning, dragging, maximizing, closing, and loading the actual popup content.', 'function_call': None, 'refusal': None, 'role': 'assistant', 'tool_calls': None}}], 'created': 1764928521, 'id': 'chatcmpl-72c6797ac91c11f0a6fe261421afc4ce', 'model': 'model', 'object': 'chat.completion', 'service_tier': None, 'system_fingerprint': None, 'usage': {'completion_tokens': 3386, 'completion_tokens_details': {'accepted_prediction_tokens': 3386, 'audio_tokens': None, 'reasoning_tokens': 24, 'rejected_prediction_tokens': 0}, 'prompt_tokens': 24, 'prompt_tokens_details': None, 'total_tokens': 3410}}Beta Was this translation helpful? Give feedback.
All reactions