diff options
| author | sigoden <sigoden@gmail.com> | 2024-08-24 12:44:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-24 12:44:11 +0800 |
| commit | 34ef752359062499d9f49c0a0155c8a11fd6f24b (patch) | |
| tree | 566b6614aaa7596c5760271029aa42d83d4bb9dc /src | |
| parent | 8e4b9a383d07a92f53a00ba6bdb304895ee32c41 (diff) | |
| download | aichat-34ef752359062499d9f49c0a0155c8a11fd6f24b.tar.gz | |
feat: support ai21 client (#800)
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/mod.rs | 3 | ||||
| -rw-r--r-- | src/client/openai.rs | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 5a4a9ac..9d6dfb0 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -40,7 +40,8 @@ register_client!( (qianwen, "qianwen", QianwenConfig, QianwenClient), ); -pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 15] = [ +pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 16] = [ + ("ai21", "https://api.ai21.com/studio/v1"), ("deepinfra", "https://api.deepinfra.com/v1/openai"), ("deepseek", "https://api.deepseek.com"), ("fireworks", "https://api.fireworks.ai/inference/v1"), diff --git a/src/client/openai.rs b/src/client/openai.rs index 3e1707f..ed577bc 100644 --- a/src/client/openai.rs +++ b/src/client/openai.rs @@ -206,6 +206,7 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod }, }) }).collect(); + let text = if text.is_empty() { Value::Null } else { text.into() }; let mut messages = vec![ json!({ "role": MessageRole::Assistant, "content": text, "tool_calls": tool_calls }) ]; |
