-
Notifications
You must be signed in to change notification settings - Fork 182
support vLLM cache salting in prefix aware scorer #1646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,13 +56,27 @@ type LLMRequestBody struct { | |
ChatCompletions *ChatCompletionsRequest `json:"chat_completions,omitempty"` | ||
} | ||
|
||
func (r *LLMRequestBody) GetCacheSalt() string { | ||
Frapschen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
if r.ChatCompletions == nil && r.Completions == nil { | ||
return "" | ||
} | ||
|
||
if r.ChatCompletions != nil { | ||
return r.ChatCompletions.CacheSalt | ||
} | ||
|
||
return r.Completions.CacheSalt | ||
} | ||
|
||
// CompletionsRequest is a structured representation of the fields we parse out of the | ||
// /v1/completions request body. | ||
// This struct includes fields usable for plugins and scheduling decisions - and not the entire | ||
// API spec. | ||
type CompletionsRequest struct { | ||
// Prompt is the prompt that was sent in the request body. | ||
Prompt string `json:"prompt,omitempty"` | ||
// CacheSalt is parameters from the vLLM security feature. | ||
Frapschen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
CacheSalt string `json:"cache_salt,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to confirm, did you test with both completion and chatcompletions request with vllm and make sure the parsing here works? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I have checked the request body definition in VLLM:
Both of them have for completion:
for chatcompletions:
|
||
} | ||
|
||
func (r *CompletionsRequest) String() string { | ||
|
@@ -88,6 +102,8 @@ type ChatCompletionsRequest struct { | |
ContinueFinalMessage bool `json:"continue_final_message,omitempty"` | ||
AddGenerationPrompt bool `json:"add_generation_prompt,omitempty"` | ||
ChatTemplateKWArgs map[string]interface{} `json:"chat_template_kwargs,omitempty"` | ||
/* parameters from the vLLM security feature */ | ||
Frapschen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
CacheSalt string `json:"cache_salt,omitempty"` | ||
} | ||
|
||
func (r *ChatCompletionsRequest) String() string { | ||
|
Uh oh!
There was an error while loading. Please reload this page.