summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/openai.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs
index 6d57d42..26c2dd3 100644
--- a/src/client/openai.rs
+++ b/src/client/openai.rs
@@ -299,7 +299,11 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod
});
if let Some(v) = model.max_tokens_param() {
- body["max_tokens"] = v.into();
+ if model.patch().and_then(|v| v.get("body").and_then(|v| v.get("max_tokens"))) == Some(&Value::Null) {
+ body["max_completion_tokens"] = v.into();
+ } else {
+ body["max_tokens"] = v.into();
+ }
}
if let Some(v) = temperature {
body["temperature"] = v.into();