Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
fcc6b41a
Unverified
Commit
fcc6b41a
authored
Aug 31, 2023
by
takatost
Committed by
GitHub
Aug 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: decrease claude model request time by set max top_k to 10 (#1071)
parent
9458b897
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
orchestrator_rule_parser.py
api/core/orchestrator_rule_parser.py
+3
-2
No files found.
api/core/orchestrator_rule_parser.py
View file @
fcc6b41a
...
@@ -283,6 +283,7 @@ class OrchestratorRuleParser:
...
@@ -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:
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment