reranker activation configuration
Browse files
src/know_lang_bot/chat_bot/chat_graph.py
CHANGED
@@ -237,6 +237,9 @@ class RetrieveContextNode(BaseNode[ChatGraphState, ChatGraphDeps, ChatResult]):
|
|
237 |
|
238 |
# Second pass: Rerank the candidates
|
239 |
try:
|
|
|
|
|
|
|
240 |
# Second pass: Rerank candidates
|
241 |
reranking = await self._rerank_chunks(
|
242 |
query=query,
|
|
|
237 |
|
238 |
# Second pass: Rerank the candidates
|
239 |
try:
|
240 |
+
if not ctx.deps.config.reranker.enabled:
|
241 |
+
raise Exception("Reranker is disabled")
|
242 |
+
|
243 |
# Second pass: Rerank candidates
|
244 |
reranking = await self._rerank_chunks(
|
245 |
query=query,
|
src/know_lang_bot/config.py
CHANGED
@@ -144,6 +144,10 @@ class DBConfig(BaseSettings):
|
|
144 |
)
|
145 |
|
146 |
class RerankerConfig(BaseSettings):
|
|
|
|
|
|
|
|
|
147 |
model_name: str = Field(
|
148 |
default="reranker",
|
149 |
description="Name of the reranker model to use"
|
|
|
144 |
)
|
145 |
|
146 |
class RerankerConfig(BaseSettings):
|
147 |
+
enabled: bool = Field(
|
148 |
+
default=True,
|
149 |
+
description="Enable reranking"
|
150 |
+
)
|
151 |
model_name: str = Field(
|
152 |
default="reranker",
|
153 |
description="Name of the reranker model to use"
|