Add Codestral edit predictions provider (#34371)
Release Notes: - Added Codestral edit predictions provider which can be enabled by adding an API key in the Mistral section of agent settings.  ## Config Get API key from https://console.mistral.ai/codestral and add it in the Mistral section of the agent settings. ``` "features": { "edit_prediction_provider": "codestral" }, "edit_predictions": { "codestral": { "model": "codestral-latest", "max_tokens": 150 } }, ``` --------- Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
@@ -377,6 +377,8 @@ pub struct EditPredictionSettings {
|
||||
pub mode: settings::EditPredictionsMode,
|
||||
/// Settings specific to GitHub Copilot.
|
||||
pub copilot: CopilotSettings,
|
||||
/// Settings specific to Codestral.
|
||||
pub codestral: CodestralSettings,
|
||||
/// Whether edit predictions are enabled in the assistant panel.
|
||||
/// This setting has no effect if globally disabled.
|
||||
pub enabled_in_text_threads: bool,
|
||||
@@ -412,6 +414,14 @@ pub struct CopilotSettings {
|
||||
pub enterprise_uri: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct CodestralSettings {
|
||||
/// Model to use for completions.
|
||||
pub model: Option<String>,
|
||||
/// Maximum tokens to generate.
|
||||
pub max_tokens: Option<u32>,
|
||||
}
|
||||
|
||||
impl AllLanguageSettings {
|
||||
/// Returns the [`LanguageSettings`] for the language with the specified name.
|
||||
pub fn language<'a>(
|
||||
@@ -622,6 +632,12 @@ impl settings::Settings for AllLanguageSettings {
|
||||
enterprise_uri: copilot.enterprise_uri,
|
||||
};
|
||||
|
||||
let codestral = edit_predictions.codestral.unwrap();
|
||||
let codestral_settings = CodestralSettings {
|
||||
model: codestral.model,
|
||||
max_tokens: codestral.max_tokens,
|
||||
};
|
||||
|
||||
let enabled_in_text_threads = edit_predictions.enabled_in_text_threads.unwrap();
|
||||
|
||||
let mut file_types: FxHashMap<Arc<str>, GlobSet> = FxHashMap::default();
|
||||
@@ -655,6 +671,7 @@ impl settings::Settings for AllLanguageSettings {
|
||||
.collect(),
|
||||
mode: edit_predictions_mode,
|
||||
copilot: copilot_settings,
|
||||
codestral: codestral_settings,
|
||||
enabled_in_text_threads,
|
||||
},
|
||||
defaults: default_language_settings,
|
||||
|
||||
Reference in New Issue
Block a user