From 08e21a0b425fafc425da37085569a9d5ac483070 Mon Sep 17 00:00:00 2001 From: geraud Date: Tue, 2 Apr 2024 14:11:27 +0200 Subject: [PATCH 1/2] add params: best_of / ignore_eos / use_beam_search / skip_special_tokens for vllm self inference support. --- src/MistralClient.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/MistralClient.php b/src/MistralClient.php index 6aafbe9..f49c0eb 100644 --- a/src/MistralClient.php +++ b/src/MistralClient.php @@ -1,6 +1,7 @@ Date: Tue, 2 Apr 2024 14:12:40 +0200 Subject: [PATCH 2/2] add params: best_of / ignore_eos / use_beam_search / skip_special_tokens for vllm self inference support. --- src/MistralClient.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MistralClient.php b/src/MistralClient.php index f49c0eb..16c3a2e 100644 --- a/src/MistralClient.php +++ b/src/MistralClient.php @@ -160,12 +160,12 @@ protected function makeChatCompletionRequest(Messages $messages, array $params, $return['n'] = $params['n']; } - if (isset($params['presence_penalty']) && is_int($params['presence_penalty']) && $params['presence_penalty'] >= -2 && $params['presence_penalty'] <= 2) { - $return['presence_penalty'] = $params['presence_penalty']; + if (isset($params['presence_penalty']) && is_numeric($params['presence_penalty']) && $params['presence_penalty'] >= -2 && $params['presence_penalty'] <= 2) { + $return['presence_penalty'] = (float) $params['presence_penalty']; } - if (isset($params['frequency_penalty']) && is_int($params['frequency_penalty'])) { - $return['frequency_penalty'] = $params['frequency_penalty']; + if (isset($params['frequency_penalty']) && is_numeric($params['frequency_penalty'])) { + $return['frequency_penalty'] = (float) $params['frequency_penalty']; } if (isset($params['best_of']) && is_int($params['best_of'])) {