diff options
| author | sigoden <sigoden@gmail.com> | 2025-02-14 19:21:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-14 19:21:41 +0800 |
| commit | 8b03cd087f5dc4da09d24766e6f0e6502c3780f0 (patch) | |
| tree | 9dbd5ea263c6c59c3d203e18c65b3049bd8bcddc /src | |
| parent | ebcf99f1d7ded70823ee8144f70e93f67b25129e (diff) | |
| download | aichat-8b03cd087f5dc4da09d24766e6f0e6502c3780f0.tar.gz | |
feat: add patch `max_tokens: null` to openai/github o* serial models (#1174)
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/openai.rs | 6 |
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(); |
