language_model: Denote the availability of language models (#15660)

This PR updates the `LanguageModel` trait with a new method for denoting
the availability of a model.

Right now we have two variants:

- `Public` for models that have no additional restrictions (other than
their respective setup/authentication requirements)
- `RequiresPlan` for models that require a specific Zed plan

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-08-01 18:26:27 -04:00 committed by GitHub
parent 906d9736d5
commit 5e011ab029
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 13 deletions

View file

@ -18,7 +18,7 @@ use std::{future, sync::Arc};
use strum::IntoEnumIterator;
use ui::prelude::*;
use crate::LanguageModelProvider;
use crate::{LanguageModelAvailability, LanguageModelProvider};
use super::anthropic::count_anthropic_tokens;
@ -236,6 +236,10 @@ impl LanguageModel for CloudLanguageModel {
format!("zed.dev/{}", self.model.id())
}
fn availability(&self) -> LanguageModelAvailability {
self.model.availability()
}
fn max_token_count(&self) -> usize {
self.model.max_token_count()
}