diff options
| author | sigoden <sigoden@gmail.com> | 2024-03-06 08:35:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-06 08:35:40 +0800 |
| commit | 8e5d4e55b1a5158a1f35adaf044dec545159f426 (patch) | |
| tree | b360cc4e9ad8acccea3c68b37057798cd1d657c0 /src/client/openai.rs | |
| parent | be4e5e569a61c54d8ac8fb77144e9b1d01e3b81f (diff) | |
| download | aichat-8e5d4e55b1a5158a1f35adaf044dec545159f426.tar.gz | |
refactor: rename model's `max_tokens` to `max_input_tokens` (#339)
BREAKING CHANGE: rename model's `max_tokens` to `max_input_tokens`
Diffstat (limited to 'src/client/openai.rs')
| -rw-r--r-- | src/client/openai.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs index 8644ae6..2c8aabf 100644 --- a/src/client/openai.rs +++ b/src/client/openai.rs @@ -12,14 +12,14 @@ use serde_json::{json, Value}; const API_BASE: &str = "https://api.openai.com/v1"; -const MODELS: [(&str, usize, &str); 7] = [ +const MODELS: [(&str, usize, &str); 5] = [ + // https://platform.openai.com/docs/models/gpt-3-5-turbo ("gpt-3.5-turbo", 16385, "text"), ("gpt-3.5-turbo-1106", 16385, "text"), + // https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo ("gpt-4-turbo-preview", 128000, "text"), ("gpt-4-vision-preview", 128000, "text,vision"), ("gpt-4-1106-preview", 128000, "text"), - ("gpt-4", 8192, "text"), - ("gpt-4-32k", 32768, "text"), ]; pub const OPENAI_TOKENS_COUNT_FACTORS: TokensCountFactors = (5, 2); @@ -46,10 +46,10 @@ impl OpenAIClient { let client_name = Self::name(local_config); MODELS .into_iter() - .map(|(name, max_tokens, capabilities)| { + .map(|(name, max_input_tokens, capabilities)| { Model::new(client_name, name) .set_capabilities(capabilities.into()) - .set_max_tokens(Some(max_tokens)) + .set_max_input_tokens(Some(max_input_tokens)) .set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS) }) .collect() |
