Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VECTOR_SEARCH_TOP_K匹配知识条数受限 #5154

Open
SKKKKYLAR opened this issue Dec 24, 2024 · 1 comment
Open

VECTOR_SEARCH_TOP_K匹配知识条数受限 #5154

SKKKKYLAR opened this issue Dec 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SKKKKYLAR
Copy link

问题描述 / Problem Description
匹配知识条数最多只能20,为啥不能修改的更高呢?
匹配的条数限制了我最后正确答案的输出,如果我的正确匹配答案有27个,就没办法找全
即使是使用了history,由于每次都是按照分数排列再取前VECTOR_SEARCH_TOP_K条信息,我就一直没办法找全
有什么办法修改VECTOR_SEARCH_TOP_K的限制吗?
或者其他的方法来解决

@SKKKKYLAR SKKKKYLAR added the bug Something isn't working label Dec 24, 2024
Copy link

dosubot bot commented Dec 24, 2024

@SKKKKYLAR Hello there! 👋 I'm here to help you with any bugs, questions, or contributions you have. I'm Dosu, a bot designed to assist you while you're waiting for a human maintainer.

To modify the VECTOR_SEARCH_TOP_K limit to allow more than 20 matches, you can adjust the top_k parameter in the SearchKbDocsParam class. This parameter is set by default to VECTOR_SEARCH_TOP_K, but you can specify a different value when creating an instance of SearchKbDocsParam. Here's an example:

from open_chatcaht.types.knowledge_base.doc.search_kb_docs_param import SearchKbDocsParam

search_params = SearchKbDocsParam(
    query="your search query",
    knowledge_base_name="your knowledge base name",
    top_k=30  # Set this to the desired number of matches
)

This will allow you to retrieve more than 20 matches by setting top_k to a higher value [1].

Additionally, there is a similar open issue discussing this limitation, where a suggested solution involves modifying the top_k in the ensemble.py and vectorstore.py files within the retrievers directory of your project. If this doesn't work, you might need to modify it in your project's virtual environment [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant