Skip to content

Commit

Permalink
Implement Seed Parameter Support for OpenAI-Compatible API Endpoints (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
GirinMan authored Apr 3, 2024
1 parent 5d2211f commit f66c48f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ struct ChatCompletionRequest {
frequency_penalty: Option<f32>,
logit_bias: Option<std::collections::HashMap<String, f32>>,
user: Option<String>,
seed: Option<u64>,
// Additional parameters
// TODO(travis): add other LoRAX params here
response_format: Option<ResponseFormat>,
Expand Down Expand Up @@ -522,6 +523,7 @@ struct CompletionRequest {
best_of: Option<i32>,
logit_bias: Option<std::collections::HashMap<String, f32>>,
user: Option<String>,
seed: Option<u64>,
// Additional parameters
// TODO(travis): add other LoRAX params here
repetition_penalty: Option<f32>,
Expand Down Expand Up @@ -653,7 +655,7 @@ impl From<CompletionRequest> for CompatGenerateRequest {
decoder_input_details: req.logprobs.is_some(),
return_k_alternatives: None,
apply_chat_template: false,
seed: None,
seed: req.seed,
response_format: None,
},
stream: req.stream.unwrap_or(false),
Expand Down Expand Up @@ -687,7 +689,7 @@ impl From<ChatCompletionRequest> for CompatGenerateRequest {
decoder_input_details: false,
return_k_alternatives: None,
apply_chat_template: true,
seed: None,
seed: req.seed,
response_format: req.response_format,
},
stream: req.stream.unwrap_or(false),
Expand Down

0 comments on commit f66c48f

Please sign in to comment.