Chore: optimize the code of PromptTransform (#16143)
This commit is contained in:
parent
e0cf55f5e9
commit
d339403e89
3 changed files with 8 additions and 11 deletions
|
|
@ -64,12 +64,10 @@ def test_get_prompt():
|
|||
transform._calculate_rest_token = MagicMock(return_value=max_token_limit)
|
||||
result = transform.get_prompt()
|
||||
|
||||
assert len(result) <= max_token_limit
|
||||
assert len(result) == 4
|
||||
|
||||
max_token_limit = 20
|
||||
transform._calculate_rest_token = MagicMock(return_value=max_token_limit)
|
||||
result = transform.get_prompt()
|
||||
|
||||
assert len(result) <= max_token_limit
|
||||
assert len(result) == 12
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ def test_get_baichuan_completion_app_prompt_template_with_pcq():
|
|||
query_in_prompt=True,
|
||||
with_memory_prompt=False,
|
||||
)
|
||||
print(prompt_template["prompt_template"].template)
|
||||
prompt_rules = prompt_template["prompt_rules"]
|
||||
assert prompt_template["prompt_template"].template == (
|
||||
prompt_rules["context_prompt"] + pre_prompt + "\n" + prompt_rules["query_prompt"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue