/auto (#16696)
Add `/auto` behind a feature flag that's disabled for now, even for staff. We've decided on a different design for context inference, but there are parts of /auto that will be useful for that, so we want them in the code base even if they're unused for now. Release Notes: - N/A --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
93a3e8bc94
commit
91ffa02e2c
42 changed files with 2776 additions and 1054 deletions
|
@ -17,14 +17,14 @@ pub enum CloudModel {
|
|||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema, EnumIter)]
|
||||
pub enum ZedModel {
|
||||
#[serde(rename = "qwen2-7b-instruct")]
|
||||
#[serde(rename = "Qwen/Qwen2-7B-Instruct")]
|
||||
Qwen2_7bInstruct,
|
||||
}
|
||||
|
||||
impl ZedModel {
|
||||
pub fn id(&self) -> &str {
|
||||
match self {
|
||||
ZedModel::Qwen2_7bInstruct => "qwen2-7b-instruct",
|
||||
ZedModel::Qwen2_7bInstruct => "Qwen/Qwen2-7B-Instruct",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ impl AnthropicModel {
|
|||
};
|
||||
|
||||
async move {
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("missing api key"))?;
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("Missing Anthropic API Key"))?;
|
||||
let request = anthropic::stream_completion(
|
||||
http_client.as_ref(),
|
||||
&api_url,
|
||||
|
|
|
@ -265,7 +265,7 @@ impl LanguageModel for GoogleLanguageModel {
|
|||
let low_speed_timeout = settings.low_speed_timeout;
|
||||
|
||||
async move {
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("missing api key"))?;
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("Missing Google API key"))?;
|
||||
let response = google_ai::count_tokens(
|
||||
http_client.as_ref(),
|
||||
&api_url,
|
||||
|
@ -304,7 +304,7 @@ impl LanguageModel for GoogleLanguageModel {
|
|||
};
|
||||
|
||||
let future = self.rate_limiter.stream(async move {
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("missing api key"))?;
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("Missing Google API Key"))?;
|
||||
let response = stream_generate_content(
|
||||
http_client.as_ref(),
|
||||
&api_url,
|
||||
|
|
|
@ -239,7 +239,7 @@ impl OpenAiLanguageModel {
|
|||
};
|
||||
|
||||
let future = self.request_limiter.stream(async move {
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("missing api key"))?;
|
||||
let api_key = api_key.ok_or_else(|| anyhow!("Missing OpenAI API Key"))?;
|
||||
let request = stream_completion(
|
||||
http_client.as_ref(),
|
||||
&api_url,
|
||||
|
|
|
@ -159,11 +159,13 @@ impl LanguageModelRegistry {
|
|||
providers
|
||||
}
|
||||
|
||||
pub fn available_models(&self, cx: &AppContext) -> Vec<Arc<dyn LanguageModel>> {
|
||||
pub fn available_models<'a>(
|
||||
&'a self,
|
||||
cx: &'a AppContext,
|
||||
) -> impl Iterator<Item = Arc<dyn LanguageModel>> + 'a {
|
||||
self.providers
|
||||
.values()
|
||||
.flat_map(|provider| provider.provided_models(cx))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn provider(&self, id: &LanguageModelProviderId) -> Option<Arc<dyn LanguageModelProvider>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue