mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Hard code max token counts for supported models (#9675)
This commit is contained in:
parent
441677c90a
commit
6d5787cfdc
@ -97,13 +97,8 @@ impl LanguageModel {
|
|||||||
|
|
||||||
pub fn max_token_count(&self) -> usize {
|
pub fn max_token_count(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
LanguageModel::OpenAi(model) => tiktoken_rs::model::get_context_size(model.id()),
|
LanguageModel::OpenAi(model) => model.max_token_count(),
|
||||||
LanguageModel::ZedDotDev(model) => match model {
|
LanguageModel::ZedDotDev(model) => model.max_token_count(),
|
||||||
ZedDotDevModel::GptThreePointFiveTurbo
|
|
||||||
| ZedDotDevModel::GptFour
|
|
||||||
| ZedDotDevModel::GptFourTurbo => tiktoken_rs::model::get_context_size(model.id()),
|
|
||||||
ZedDotDevModel::Custom(_) => 30720, // TODO: Base this on the selected model.
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,15 @@ impl ZedDotDevModel {
|
|||||||
Self::Custom(id) => id.as_str(),
|
Self::Custom(id) => id.as_str(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn max_token_count(&self) -> usize {
|
||||||
|
match self {
|
||||||
|
Self::GptThreePointFiveTurbo => 2048,
|
||||||
|
Self::GptFour => 4096,
|
||||||
|
Self::GptFourTurbo => 128000,
|
||||||
|
Self::Custom(_) => 4096, // TODO: Make this configurable
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)]
|
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
|
@ -72,6 +72,14 @@ impl Model {
|
|||||||
Self::FourTurbo => "gpt-4-turbo",
|
Self::FourTurbo => "gpt-4-turbo",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn max_token_count(&self) -> usize {
|
||||||
|
match self {
|
||||||
|
Model::ThreePointFiveTurbo => 4096,
|
||||||
|
Model::Four => 8192,
|
||||||
|
Model::FourTurbo => 128000,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
Loading…
Reference in New Issue
Block a user