1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
5#[serde(tag = "provider", rename_all = "lowercase")]
6pub enum CloudModel {
7 Anthropic(anthropic::Model),
8 OpenAi(open_ai::Model),
9 Google(google_ai::Model),
10}
11
12impl Default for CloudModel {
13 fn default() -> Self {
14 Self::Anthropic(anthropic::Model::default())
15 }
16}
17
18impl CloudModel {
19 pub fn id(&self) -> &str {
20 match self {
21 CloudModel::Anthropic(model) => model.id(),
22 CloudModel::OpenAi(model) => model.id(),
23 CloudModel::Google(model) => model.id(),
24 }
25 }
26
27 pub fn display_name(&self) -> &str {
28 match self {
29 CloudModel::Anthropic(model) => model.display_name(),
30 CloudModel::OpenAi(model) => model.display_name(),
31 CloudModel::Google(model) => model.display_name(),
32 }
33 }
34
35 pub fn max_token_count(&self) -> usize {
36 match self {
37 CloudModel::Anthropic(model) => model.max_token_count(),
38 CloudModel::OpenAi(model) => model.max_token_count(),
39 CloudModel::Google(model) => model.max_token_count(),
40 }
41 }
42}