소스 검색

Fix a small typo in count of used fragments (#8673)

### What problem does this PR solve?

Fix a small typo in count of used fragments.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
tags/v0.20.0
kwrobel.eth 4 달 전
부모
커밋
8a3b5d1d76
No account linked to committer's email address
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2
    1
      rag/prompts.py

+ 2
- 1
rag/prompts.py 파일 보기

@@ -104,6 +104,7 @@ def kb_prompt(kbinfos, max_tokens):
from api.db.services.document_service import DocumentService

knowledges = [ck["content_with_weight"] for ck in kbinfos["chunks"]]
kwlg_len = len(knowledges)
used_token_count = 0
chunks_num = 0
for i, c in enumerate(knowledges):
@@ -111,7 +112,7 @@ def kb_prompt(kbinfos, max_tokens):
chunks_num += 1
if max_tokens * 0.97 < used_token_count:
knowledges = knowledges[:i]
logging.warning(f"Not all the retrieval into prompt: {i + 1}/{len(knowledges)}")
logging.warning(f"Not all the retrieval into prompt: {len(knowledges)}/{kwlg_len}")
break

docs = DocumentService.get_by_ids([ck["doc_id"] for ck in kbinfos["chunks"][:chunks_num]])

Loading…
취소
저장