Originally created by @juananpe on GitHub (Dec 8, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7698
### Issue Description
I think that there is a parameter mismatch in the call to the `query_doc` function in `backend/open_webui/apps/retrieval/main.py`. The `query_doc` in `utils.py`:
https://github.com/open-webui/open-webui/blob/29a271959556743e6deb4d55a5a982983335d7ab/backend/open_webui/apps/retrieval/utils.py#L61-L65
function currently expects three parameters (`collection_name`, `query_embedding`, and `k`), but four parameters (`collection_name`, `query`, `embedding_function`, and `k`) are being passed here:
https://github.com/open-webui/open-webui/blob/29a271959556743e6deb4d55a5a982983335d7ab/backend/open_webui/apps/retrieval/main.py#L1371-L1376
### Proposed Solution
Modify the call to `query_doc` to compute the `query_embedding` using the `embedding_function` before passing it to `query_doc`. Something like this:
```python
query_embedding = app.state.EMBEDDING_FUNCTION(form_data.query)
return query_doc(
collection_name=form_data.collection_name,
query_embedding=query_embedding,
k=form_data.k if form_data.k else app.state.config.TOP_K,
)
```
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 @juananpe on GitHub (Dec 8, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7698
Issue Description
I think that there is a parameter mismatch in the call to the
query_docfunction inbackend/open_webui/apps/retrieval/main.py. Thequery_docinutils.py:https://github.com/open-webui/open-webui/blob/29a271959556743e6deb4d55a5a982983335d7ab/backend/open_webui/apps/retrieval/utils.py#L61-L65
function currently expects three parameters (
collection_name,query_embedding, andk), but four parameters (collection_name,query,embedding_function, andk) are being passed here:https://github.com/open-webui/open-webui/blob/29a271959556743e6deb4d55a5a982983335d7ab/backend/open_webui/apps/retrieval/main.py#L1371-L1376
Proposed Solution
Modify the call to
query_docto compute thequery_embeddingusing theembedding_functionbefore passing it toquery_doc. Something like this:@tjbck commented on GitHub (Dec 10, 2024):
Good catch, fixed on dev!