feat: decrease claude model request time by set max top_k to 10 (#1071)
This commit is contained in:
parent
9458b8978f
commit
fcc6b41ab7
1 changed files with 3 additions and 2 deletions
|
|
@ -283,6 +283,7 @@ class OrchestratorRuleParser:
|
||||||
def _dynamic_calc_retrieve_k(cls, dataset: Dataset, rest_tokens: int) -> int:
|
def _dynamic_calc_retrieve_k(cls, dataset: Dataset, rest_tokens: int) -> int:
|
||||||
DEFAULT_K = 2
|
DEFAULT_K = 2
|
||||||
CONTEXT_TOKENS_PERCENT = 0.3
|
CONTEXT_TOKENS_PERCENT = 0.3
|
||||||
|
MAX_K = 10
|
||||||
|
|
||||||
if rest_tokens == -1:
|
if rest_tokens == -1:
|
||||||
return DEFAULT_K
|
return DEFAULT_K
|
||||||
|
|
@ -311,5 +312,5 @@ class OrchestratorRuleParser:
|
||||||
if context_limit_tokens <= segment_max_tokens * DEFAULT_K:
|
if context_limit_tokens <= segment_max_tokens * DEFAULT_K:
|
||||||
return DEFAULT_K
|
return DEFAULT_K
|
||||||
|
|
||||||
# Expand the k value when there's still some room left in the 30% rest tokens space
|
# Expand the k value when there's still some room left in the 30% rest tokens space, but less than the MAX_K
|
||||||
return context_limit_tokens // segment_max_tokens
|
return min(context_limit_tokens // segment_max_tokens, MAX_K)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue