Files
rust-genai/examples/c05-model-names.rs
Jeremy Chone 33fb9dcff6 ! now Client::all_model_names() (replaces Client::list_model_names())
^ groq - add gemma2-9b-it to the list of Groq models
2024-07-10 08:34:54 -07:00

28 lines
659 B
Rust

//! Example to show how to get the list of models per AdapterKind
//! Note: For now, only Ollama makes a dynamic query. Other adapters have a static list of models.
use genai::adapter::AdapterKind;
use genai::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
const KINDS: &[AdapterKind] = &[
AdapterKind::OpenAI,
AdapterKind::Ollama,
AdapterKind::Gemini,
AdapterKind::Anthropic,
AdapterKind::Groq,
AdapterKind::Cohere,
];
let client = Client::default();
for &kind in KINDS {
println!("\n--- Models for {kind}");
let models = client.all_model_names(kind).await?;
println!("{models:?}");
}
Ok(())
}