From fe35cfd9419302f01baf9672493c0b0a4b41d889 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 13 Jan 2024 19:52:07 +0800 Subject: feat: supports model capabilities (#297) 1. automatically switch to the model that has the necessary capabilities. 2. throw an error if the client does not have a model with the necessary capabilities --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 4d199aa..5d8315d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use crate::config::{Config, GlobalConfig}; use anyhow::Result; use clap::Parser; -use client::{init_client, list_models}; +use client::{ensure_model_capabilities, init_client, list_models}; use config::Input; use is_terminal::IsTerminal; use parking_lot::RwLock; @@ -114,7 +114,8 @@ fn start_directive( session.guard_save()?; } let input = Input::new(text, include.unwrap_or_default())?; - let client = init_client(config)?; + let mut client = init_client(config)?; + ensure_model_capabilities(client.as_mut(), input.required_capabilities())?; config.read().maybe_print_send_tokens(&input); let output = if no_stream { let output = client.send_message(input.clone())?; -- cgit v1.2.3