From 711ede104e7d30ba5bcc60c36f005700355ee92f Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Mira Date: Fri, 28 Jun 2024 12:07:41 +0200 Subject: [PATCH] add paramter num_ctx to openai compatibility --- openai/openai.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openai/openai.go b/openai/openai.go index 706d31aa..11c3408c 100644 --- a/openai/openai.go +++ b/openai/openai.go @@ -63,6 +63,7 @@ type ChatCompletionRequest struct { FrequencyPenalty *float64 `json:"frequency_penalty"` PresencePenalty *float64 `json:"presence_penalty_penalty"` TopP *float64 `json:"top_p"` + NumCtx *int `json:"num_ctx"` ResponseFormat *ResponseFormat `json:"response_format"` } @@ -194,6 +195,10 @@ func fromRequest(r ChatCompletionRequest) api.ChatRequest { options["top_p"] = 1.0 } + if r.NumCtx != nil { + options["num_ctx"] = *r.NumCtx + } + var format string if r.ResponseFormat != nil && r.ResponseFormat.Type == "json_object" { format = "json"