mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 18:39:07 +08:00
refine context length (#1813)
### What problem does this PR solve? #1594 ### Type of change - [x] Performance Improvement
This commit is contained in:
parent
5b013da4d6
commit
5650442b0b
@ -68,7 +68,7 @@ def build_knowlege_graph_chunks(tenant_id: str, chunks: List[str], callback, ent
|
|||||||
llm_bdl = LLMBundle(tenant_id, LLMType.CHAT)
|
llm_bdl = LLMBundle(tenant_id, LLMType.CHAT)
|
||||||
ext = GraphExtractor(llm_bdl)
|
ext = GraphExtractor(llm_bdl)
|
||||||
left_token_count = llm_bdl.max_length - ext.prompt_token_count - 1024
|
left_token_count = llm_bdl.max_length - ext.prompt_token_count - 1024
|
||||||
left_token_count = llm_bdl.max_length * 0.4
|
left_token_count = max(llm_bdl.max_length * 0.8, left_token_count)
|
||||||
|
|
||||||
assert left_token_count > 0, f"The LLM context length({llm_bdl.max_length}) is smaller than prompt({ext.prompt_token_count})"
|
assert left_token_count > 0, f"The LLM context length({llm_bdl.max_length}) is smaller than prompt({ext.prompt_token_count})"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user