diff --git a/crates/tabby/src/services/answer.rs b/crates/tabby/src/services/answer.rs index 2fa60bdc6812..0f9cee0a9881 100644 --- a/crates/tabby/src/services/answer.rs +++ b/crates/tabby/src/services/answer.rs @@ -126,7 +126,7 @@ impl AnswerService { // 5. Generate answer from the query let s = self.chat.clone().generate(ChatCompletionRequestBuilder::default() .messages(req.messages.clone()) - .presence_penalty(PRESENCE_PENALTY) + .presence_penalty(Some(PRESENCE_PENALTY)) .build() .expect("Failed to create ChatCompletionRequest")) .await; diff --git a/crates/tabby/src/services/chat.rs b/crates/tabby/src/services/chat.rs index b48128c04cd0..c7f303db51b2 100644 --- a/crates/tabby/src/services/chat.rs +++ b/crates/tabby/src/services/chat.rs @@ -35,8 +35,8 @@ pub struct ChatCompletionRequest { #[builder(default = "None")] seed: Option, - #[builder(default = "0.0")] - presence_penalty: f32, + #[builder(default = "None")] + presence_penalty: Option, } #[derive(Serialize, Deserialize, ToSchema, Clone, Debug)] @@ -106,8 +106,10 @@ impl ChatService { request.seed.inspect(|x| { builder.seed(*x); }); + request.presence_penalty.inspect(|x| { + builder.presence_penalty(*x); + }); builder - .presence_penalty(request.presence_penalty) .build() .expect("Failed to create ChatCompletionOptions") };