瀏覽代碼

roll back rerank topn setting (#11297)

tags/0.13.0
Jyong 11 月之前
父節點
當前提交
c58d2fce89
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 3 行新增7 行删除
  1. 0
    1
      api/.env.example
  2. 0
    2
      api/configs/feature/__init__.py
  3. 3
    4
      api/core/rag/datasource/retrieval_service.py

+ 0
- 1
api/.env.example 查看文件

@@ -413,4 +413,3 @@ RESET_PASSWORD_TOKEN_EXPIRY_MINUTES=5

CREATE_TIDB_SERVICE_JOB_ENABLED=false

RETRIEVAL_TOP_N=0

+ 0
- 2
api/configs/feature/__init__.py 查看文件

@@ -626,8 +626,6 @@ class DataSetConfig(BaseSettings):
default=30,
)

RETRIEVAL_TOP_N: int = Field(description="number of retrieval top_n", default=0)


class WorkspaceConfig(BaseSettings):
"""

+ 3
- 4
api/core/rag/datasource/retrieval_service.py 查看文件

@@ -3,7 +3,6 @@ from typing import Optional

from flask import Flask, current_app

from configs import DifyConfig
from core.rag.data_post_processor.data_post_processor import DataPostProcessor
from core.rag.datasource.keyword.keyword_factory import Keyword
from core.rag.datasource.vdb.vector_factory import Vector
@@ -114,7 +113,7 @@ class RetrievalService:
query=query,
documents=all_documents,
score_threshold=score_threshold,
top_n=DifyConfig.RETRIEVAL_TOP_N or top_k,
top_n=top_k,
)

return all_documents
@@ -186,7 +185,7 @@ class RetrievalService:
query=query,
documents=documents,
score_threshold=score_threshold,
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents),
top_n=len(documents),
)
)
else:
@@ -231,7 +230,7 @@ class RetrievalService:
query=query,
documents=documents,
score_threshold=score_threshold,
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents),
top_n=len(documents),
)
)
else:

Loading…
取消
儲存