We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e039407 commit b65638eCopy full SHA for b65638e
vllm/entrypoints/context.py
@@ -49,9 +49,17 @@ class SimpleContext(ConversationContext):
49
50
def __init__(self):
51
self.last_output = None
52
+ self.num_prompt_tokens = 0
53
+ self.num_output_tokens = 0
54
+ self.num_cached_tokens = 0
55
56
def append_output(self, output) -> None:
57
self.last_output = output
58
+ if not isinstance(output, RequestOutput):
59
+ raise ValueError("SimpleContext only supports RequestOutput.")
60
+ self.num_prompt_tokens = len(output.prompt_token_ids)
61
+ self.num_cached_tokens = output.num_cached_tokens
62
+ self.num_output_tokens += len(output.outputs[0].token_ids)
63
64
def need_builtin_tool_call(self) -> bool:
65
return False
0 commit comments