[GH-ISSUE #10670] The rag result on the web side is better than the api call result. #119295

Closed
opened 2026-05-20 20:24:32 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @zxjhellow2 on GitHub (Feb 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10670

I've called the same knowledge base both through the web side and the api, but the api calls are answering poorly.
question is "李俊杰做了什么研究?"

The RAG on the web side gives better results.

Image

The api call is implemented with the following code.

import requests

def chat_with_collection(token, model, query, collection_id):
    url = 'http://localhost:3000/api/chat/completions'
    headers = {
        'Authorization': f'Bearer {token}',
        'Content-Type': 'application/json'
    }
    payload = {
        'model': model,
        'messages': [{'role': 'user', 'content': query}],
        'files': [{'type': 'collection', 'id': collection_id}]
    }
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

the answer is bad, displays that the documents related to the question asked cannot be searched.

Image

Originally created by @zxjhellow2 on GitHub (Feb 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/10670 I've called the same knowledge base both through the web side and the api, but the api calls are answering poorly. question is "李俊杰做了什么研究?" The RAG on the web side gives better results. ![Image](https://github.com/user-attachments/assets/ea2d8d61-ffb2-4a02-86d2-077f61641580) The api call is implemented with the following code. ```python import requests def chat_with_collection(token, model, query, collection_id): url = 'http://localhost:3000/api/chat/completions' headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' } payload = { 'model': model, 'messages': [{'role': 'user', 'content': query}], 'files': [{'type': 'collection', 'id': collection_id}] } response = requests.post(url, headers=headers, json=payload) return response.json() ``` the answer is bad, displays that the documents related to the question asked cannot be searched. ![Image](https://github.com/user-attachments/assets/f1f0bff3-c841-4ea3-9598-0da5e2a14058)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#119295