Unverified Commit 2f7b234c authored by takatost's avatar takatost Committed by GitHub

fix: max token not exist in generate summary when calc rest tokens (#891)

parent 4f5f9506
...@@ -51,6 +51,7 @@ class LLMGenerator: ...@@ -51,6 +51,7 @@ class LLMGenerator:
prompt_with_empty_context = prompt.format(context='') prompt_with_empty_context = prompt.format(context='')
prompt_tokens = model_instance.get_num_tokens([PromptMessage(content=prompt_with_empty_context)]) prompt_tokens = model_instance.get_num_tokens([PromptMessage(content=prompt_with_empty_context)])
max_context_token_length = model_instance.model_rules.max_tokens.max max_context_token_length = model_instance.model_rules.max_tokens.max
max_context_token_length = max_context_token_length if max_context_token_length else 1500
rest_tokens = max_context_token_length - prompt_tokens - max_tokens - 1 rest_tokens = max_context_token_length - prompt_tokens - max_tokens - 1
context = '' context = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment