Skip to content

Commit 05d6fbf

Browse files
authored
fix name of usage.prompt_tokens_details (#559)
Signed-off-by: Maya Barnea <mayab@il.ibm.com>
1 parent 60104ff commit 05d6fbf

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/http-enpdpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Structure of requests/responses
7575
- prompt_tokens
7676
- completion_tokens
7777
- total_tokens
78-
- prompt_tokens_detail
78+
- prompt_tokens_details
7979
- cached_tokens
8080
- object
8181
- kv_transfer_params

docs/kv-cache.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ When KV cache is enabled, the response `usage` object includes cached token info
216216
"prompt_tokens": 100,
217217
"completion_tokens": 50,
218218
"total_tokens": 150,
219-
"prompt_tokens_detail": {
219+
"prompt_tokens_details": {
220220
"cached_tokens": 64
221221
}
222222
}

pkg/api/response.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ type Usage struct {
7979
CompletionTokens int `json:"completion_tokens"`
8080
// TotalTokens is the total number of tokens processed for the request (the sum of the two values above)
8181
TotalTokens int `json:"total_tokens"`
82-
// PromptTokensDetail contains detailed token usage statistics for the prompt
83-
PromptTokensDetail *PromptTokensDetail `json:"prompt_tokens_detail"`
82+
// PromptTokensDetails contains detailed token usage statistics for the prompt
83+
PromptTokensDetails *PromptTokensDetails `json:"prompt_tokens_details"`
8484
}
8585

86-
// PromptTokensDetail contains detailed token usage statistics for the prompt
87-
type PromptTokensDetail struct {
86+
// PromptTokensDetails contains detailed token usage statistics for the prompt
87+
type PromptTokensDetails struct {
8888
// CacheTokens is the number of tokens in the prompt that are in the local KV Cache
8989
CachedTokens int `json:"cached_tokens"`
9090
}

pkg/communication/response_builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ func aggregateUsage(respCtxPerChoice []vllmsim.ResponseContext) *api.Usage {
115115
if !seenIDs[rc.RequestID()] {
116116
seenIDs[rc.RequestID()] = true
117117
agg.PromptTokens += u.PromptTokens
118-
if u.PromptTokensDetail != nil && agg.PromptTokensDetail == nil {
119-
agg.PromptTokensDetail = u.PromptTokensDetail
118+
if u.PromptTokensDetails != nil && agg.PromptTokensDetails == nil {
119+
agg.PromptTokensDetails = u.PromptTokensDetails
120120
}
121121
}
122122
}

pkg/llm-d-inference-sim/request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (reqCtx *baseRequestContext) handleRequest() (ResponseContext, *api.Error)
238238
PromptTokens: numOfInputTokens,
239239
CompletionTokens: completionTokens,
240240
TotalTokens: numOfInputTokens + completionTokens,
241-
PromptTokensDetail: &api.PromptTokensDetail{
241+
PromptTokensDetails: &api.PromptTokensDetails{
242242
CachedTokens: prefixCacheStats.CachedTokens,
243243
},
244244
}

0 commit comments

Comments
 (0)