bunsen-tool 0.43.0

bunsen's models on the command line: speech to text (Parakeet, Qwen3-ASR, Voxtral Realtime, Whisper) and who spoke when (Sortformer), text to speech (ZONOS3, Qwen3-TTS), chat (Qwen3, Qwen3.5, Gemma, nanochat) and typed decisions (Laya). The chat driver is also a library, `bunsen_tool::chat`.
Documentation
//! `chat repl`.

use bunsen::errors::BunsenResult;
use clap::ArgMatches;

use crate::{
    chat::{
        ChatGenerateFlags,
        ChatModelFamily,
        ChatModelFamilyFlags,
    },
    support::log_build,
};

/// Holds a conversation on stdin; `F` is the family's own generation flags.
#[derive(clap::Args, Debug)]
pub struct ChatReplCommand<F: clap::Args> {
    #[clap(flatten)]
    flags: ChatGenerateFlags,

    #[clap(flatten)]
    family: F,
}

impl<F: ChatModelFamilyFlags> ChatReplCommand<F> {
    /// Holds a conversation with `family`'s checkpoint, or outside `family`
    /// whichever `--model` names.
    ///
    /// `matches` are the command's own, for the stage flags' order.
    pub fn run(
        &self,
        family: Option<ChatModelFamily>,
        matches: &ArgMatches,
    ) -> BunsenResult<()> {
        let (device, chat, model, build) =
            self.flags.load(family, &self.family.presets(), matches)?;
        log_build(&model, &build);
        eprintln!("# {build}");
        eprintln!("# /quit to exit");
        self.flags.converse(&chat, &self.family, &device, &model)?;
        drop(chat);
        device.close()
    }
}