intel / intel-extension-for-transformers

⚡ Build your chatbot within minutes on your favorite device; offer SOTA compression techniques for LLMs; run LLMs efficiently on Intel Platforms⚡
Apache License 2.0
2.14k stars 211 forks source link

rag plugin init failed if retrieval_type is bm25 #1315

Closed redhairerINTEL closed 8 months ago

redhairerINTEL commented 8 months ago
image

Thanks for Ren, Xuhui suggest to add bm25 to allowed_retrieval_type.

diff --git a/intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/retrieval_agent.py b/intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/retrieval_agent.py
index 176a49fd768..31b01ac4687 100644
--- a/intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/retrieval_agent.py
+++ b/intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/retrieval_agent.py
@@ -64,7 +64,7 @@ class Agent_QA():
                  input_path = None,
                  response_template="Please reformat your query to regenerate the answer.",
                  asset_path="/intel-extension-for-transformers/intel_extension_for_transformers/neural_chat/assets",
-                 retrieval_type = 'default',
+                 retrieval_type = 'bm25',
                  max_chuck_size=512,
                  min_chuck_size=5,
                  mode = "accuracy",
@@ -86,6 +86,7 @@ class Agent_QA():
                     if 'child_size' in kwargs else 512)
         allowed_retrieval_type: ClassVar[Collection[str]] = (
             "default",
+            "bm25",
             "child_parent",
         )
         allowed_generation_mode: ClassVar[Collection[str]] = (
XuhuiRen commented 8 months ago

share the similar issue in #1309 , already fixed