reasonkit-core 0.1.8

The Reasoning Engine — Auditable Reasoning for Production AI | Rust-Native | Turn Prompts into Protocols
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
//! # LLM CLI Ecosystem Integration
//!
//! Integrates Simon Willison's LLM CLI tool for multi-model orchestration,
//! embeddings, clustering, and RAG pipelines.
//!
//! ## Usage
//!
//! ```rust,ignore
//! use reasonkit::thinktool::llm_cli::{LlmCliClient, EmbeddingConfig, ClusterConfig};
//!
//! let client = LlmCliClient::new()?;
//!
//! // Execute a prompt
//! let response = client.prompt("Analyze this code", Some("claude-sonnet-4")).await?;
//!
//! // Generate embeddings
//! let embeddings = client.embed("text to embed", None).await?;
//!
//! // Cluster documents
//! let clusters = client.cluster("documents", 5, None).await?;
//! ```
//!
//! ## Security
//!
//! All user-provided inputs are validated and sanitized before being passed to
//! shell commands. This includes:
//! - Model names (alphanumeric, hyphens, underscores, slashes, colons, dots)
//! - Collection names (alphanumeric, hyphens, underscores)
//! - Database paths (validated as safe filesystem paths)
//! - Template names (alphanumeric, hyphens, underscores)

use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::process::Command;

use crate::error::{Error, Result};

/// Maximum length for user-provided string inputs to prevent DoS
const MAX_INPUT_LENGTH: usize = 10_000;

/// Maximum length for identifiers (model names, collection names, etc.)
const MAX_IDENTIFIER_LENGTH: usize = 256;

/// Validate and sanitize a model name.
/// Allowed characters: alphanumeric, hyphens, underscores, slashes, colons, dots.
/// Examples: "gpt-4o-mini", "claude-sonnet-4", "sentence-transformers/all-MiniLM-L6-v2"
fn validate_model_name(model: &str) -> Result<&str> {
    if model.is_empty() {
        return Err(Error::Validation("Model name cannot be empty".to_string()));
    }
    if model.len() > MAX_IDENTIFIER_LENGTH {
        return Err(Error::Validation(format!(
            "Model name exceeds maximum length of {} characters",
            MAX_IDENTIFIER_LENGTH
        )));
    }
    // Allow alphanumeric, hyphens, underscores, slashes, colons, dots
    // This covers: gpt-4o-mini, claude-3, sentence-transformers/all-MiniLM-L6-v2
    if !model
        .chars()
        .all(|c| c.is_alphanumeric() || c == '-' || c == '_' || c == '/' || c == ':' || c == '.')
    {
        return Err(Error::Validation(format!(
            "Model name contains invalid characters: '{}'. Allowed: alphanumeric, -, _, /, :, .",
            model
        )));
    }
    // Prevent path traversal attempts
    if model.contains("..") {
        return Err(Error::Validation(
            "Model name cannot contain '..' (path traversal)".to_string(),
        ));
    }
    Ok(model)
}

/// Validate a collection name.
/// Allowed characters: alphanumeric, hyphens, underscores.
fn validate_collection_name(collection: &str) -> Result<&str> {
    if collection.is_empty() {
        return Err(Error::Validation(
            "Collection name cannot be empty".to_string(),
        ));
    }
    if collection.len() > MAX_IDENTIFIER_LENGTH {
        return Err(Error::Validation(format!(
            "Collection name exceeds maximum length of {} characters",
            MAX_IDENTIFIER_LENGTH
        )));
    }
    // Collection names should be simple identifiers
    if !collection
        .chars()
        .all(|c| c.is_alphanumeric() || c == '-' || c == '_')
    {
        return Err(Error::Validation(format!(
            "Collection name contains invalid characters: '{}'. Allowed: alphanumeric, -, _",
            collection
        )));
    }
    Ok(collection)
}

/// Validate a template name.
/// Allowed characters: alphanumeric, hyphens, underscores.
fn validate_template_name(template: &str) -> Result<&str> {
    if template.is_empty() {
        return Err(Error::Validation(
            "Template name cannot be empty".to_string(),
        ));
    }
    if template.len() > MAX_IDENTIFIER_LENGTH {
        return Err(Error::Validation(format!(
            "Template name exceeds maximum length of {} characters",
            MAX_IDENTIFIER_LENGTH
        )));
    }
    if !template
        .chars()
        .all(|c| c.is_alphanumeric() || c == '-' || c == '_')
    {
        return Err(Error::Validation(format!(
            "Template name contains invalid characters: '{}'. Allowed: alphanumeric, -, _",
            template
        )));
    }
    Ok(template)
}

/// Format a dangerous character for display in error messages.
fn format_dangerous_char(c: char) -> String {
    match c {
        '\n' => "\\n".to_string(),
        '\r' => "\\r".to_string(),
        '\0' => "\\0".to_string(),
        _ => c.to_string(),
    }
}

/// Validate a database path.
/// Must be a valid path without shell metacharacters.
fn validate_db_path(path: &str) -> Result<&str> {
    if path.is_empty() {
        return Err(Error::Validation(
            "Database path cannot be empty".to_string(),
        ));
    }
    if path.len() > 4096 {
        return Err(Error::Validation(
            "Database path exceeds maximum length".to_string(),
        ));
    }
    // Reject shell metacharacters and control characters
    // Safe characters: alphanumeric, path separators, dots, hyphens, underscores
    let dangerous_chars = [
        '$', '`', '!', '&', '|', ';', '(', ')', '{', '}', '<', '>', '\n', '\r', '\0', '"', '\'',
        '\\',
    ];
    for c in dangerous_chars {
        if path.contains(c) {
            return Err(Error::Validation(format!(
                "Database path contains dangerous character: '{}'",
                format_dangerous_char(c)
            )));
        }
    }
    // Prevent path traversal
    if path.contains("..") {
        return Err(Error::Validation(
            "Database path cannot contain '..' (path traversal)".to_string(),
        ));
    }
    Ok(path)
}

/// Validate user input text (prompts, system messages).
/// Limits length to prevent DoS attacks.
fn validate_user_input(input: &str) -> Result<&str> {
    if input.len() > MAX_INPUT_LENGTH {
        return Err(Error::Validation(format!(
            "Input exceeds maximum length of {} characters",
            MAX_INPUT_LENGTH
        )));
    }
    Ok(input)
}

/// Configuration for the LLM CLI client
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LlmCliConfig {
    /// Path to the LLM CLI binary (default: "llm")
    pub binary_path: PathBuf,
    /// Default model to use
    pub default_model: Option<String>,
    /// Default embedding model
    pub default_embedding_model: Option<String>,
    /// Database path for embeddings
    pub database_path: Option<PathBuf>,
}

impl Default for LlmCliConfig {
    fn default() -> Self {
        Self {
            binary_path: PathBuf::from("llm"),
            default_model: None,
            default_embedding_model: None,
            database_path: None,
        }
    }
}

/// Configuration for embedding operations
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct EmbeddingConfig {
    /// Embedding model to use
    pub model: Option<String>,
    /// Collection name for storing embeddings
    pub collection: Option<String>,
    /// Database path
    pub database: Option<PathBuf>,
    /// Store metadata with embeddings
    pub store_metadata: bool,
}

/// Configuration for clustering operations
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ClusterConfig {
    /// Embedding model for clustering
    pub model: Option<String>,
    /// Output format (json, csv, etc.)
    pub format: Option<String>,
    /// Include summary in output
    pub summary: bool,
}

/// Configuration for RAG operations
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagConfig {
    /// Collection to search
    pub collection: String,
    /// Number of results to retrieve
    pub top_k: usize,
    /// Model for generation
    pub model: Option<String>,
    /// System prompt for RAG
    pub system_prompt: Option<String>,
}

impl Default for RagConfig {
    fn default() -> Self {
        Self {
            collection: "default".to_string(),
            top_k: 5,
            model: None,
            system_prompt: None,
        }
    }
}

/// Result from an LLM prompt
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PromptResult {
    /// The generated response
    pub response: String,
    /// Model used
    pub model: String,
    /// Tokens used (if available)
    pub tokens_used: Option<u64>,
}

/// Result from embedding operation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmbeddingResult {
    /// The embedding vector
    pub embedding: Vec<f32>,
    /// Text that was embedded
    pub text: String,
    /// Model used
    pub model: String,
}

/// Result from clustering operation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClusterResult {
    /// Cluster assignments
    pub clusters: Vec<ClusterAssignment>,
    /// Cluster summaries (if requested)
    pub summaries: Option<Vec<String>>,
}

/// Individual cluster assignment
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClusterAssignment {
    /// Document ID or index
    pub id: String,
    /// Assigned cluster
    pub cluster: usize,
    /// Similarity score within cluster
    pub score: Option<f64>,
}

/// Result from similarity search
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SimilarityResult {
    /// Matching documents
    pub matches: Vec<SimilarityMatch>,
}

/// Individual similarity match
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SimilarityMatch {
    /// Document content
    pub content: String,
    /// Similarity score
    pub score: f64,
    /// Document ID
    pub id: Option<String>,
    /// Metadata
    pub metadata: Option<serde_json::Value>,
}

/// LLM CLI Client for multi-model orchestration
#[derive(Debug, Clone)]
pub struct LlmCliClient {
    config: LlmCliConfig,
}

impl LlmCliClient {
    /// Create a new LLM CLI client with default configuration
    pub fn new() -> Result<Self> {
        Ok(Self {
            config: LlmCliConfig::default(),
        })
    }

    /// Create a new LLM CLI client with custom configuration
    pub fn with_config(config: LlmCliConfig) -> Self {
        Self { config }
    }

    /// Check if the LLM CLI is available
    pub fn is_available(&self) -> bool {
        Command::new(&self.config.binary_path)
            .arg("--version")
            .output()
            .map(|o| o.status.success())
            .unwrap_or(false)
    }

    /// List available models
    pub fn list_models(&self) -> Result<Vec<String>> {
        let output = Command::new(&self.config.binary_path)
            .arg("models")
            .arg("list")
            .output()
            .map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        let stdout = String::from_utf8_lossy(&output.stdout);
        Ok(stdout.lines().map(String::from).collect())
    }

    /// Execute a prompt with the LLM CLI
    pub fn prompt(&self, text: &str, model: Option<&str>) -> Result<PromptResult> {
        // Validate inputs
        let validated_text = validate_user_input(text)?;
        let validated_model = match model {
            Some(m) => Some(validate_model_name(m)?),
            None => None,
        };

        let mut cmd = Command::new(&self.config.binary_path);

        if let Some(m) = validated_model.or(self.config.default_model.as_deref()) {
            cmd.arg("-m").arg(m);
        }

        cmd.arg(validated_text);

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        Ok(PromptResult {
            response: String::from_utf8_lossy(&output.stdout).to_string(),
            model: validated_model
                .or(self.config.default_model.as_deref())
                .unwrap_or("default")
                .to_string(),
            tokens_used: None,
        })
    }

    /// Execute a prompt with system message
    pub fn prompt_with_system(
        &self,
        text: &str,
        system: &str,
        model: Option<&str>,
    ) -> Result<PromptResult> {
        // Validate inputs
        let validated_text = validate_user_input(text)?;
        let validated_system = validate_user_input(system)?;
        let validated_model = match model {
            Some(m) => Some(validate_model_name(m)?),
            None => None,
        };

        let mut cmd = Command::new(&self.config.binary_path);

        if let Some(m) = validated_model.or(self.config.default_model.as_deref()) {
            cmd.arg("-m").arg(m);
        }

        cmd.arg("-s").arg(validated_system);
        cmd.arg(validated_text);

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        Ok(PromptResult {
            response: String::from_utf8_lossy(&output.stdout).to_string(),
            model: validated_model
                .or(self.config.default_model.as_deref())
                .unwrap_or("default")
                .to_string(),
            tokens_used: None,
        })
    }

    /// Generate embeddings for text
    pub fn embed(&self, text: &str, config: Option<&EmbeddingConfig>) -> Result<EmbeddingResult> {
        // Validate inputs
        let validated_text = validate_user_input(text)?;

        let mut cmd = Command::new(&self.config.binary_path);
        cmd.arg("embed");

        // Validate and add optional config
        if let Some(cfg) = config {
            if let Some(ref m) = cfg.model {
                let validated = validate_model_name(m)?;
                cmd.arg("-m").arg(validated);
            }
            if let Some(ref c) = cfg.collection {
                let validated = validate_collection_name(c)?;
                cmd.arg("-c").arg(validated);
            }
            if let Some(ref db) = cfg.database {
                let db_str = db.to_string_lossy();
                let validated = validate_db_path(&db_str)?;
                cmd.arg("-d").arg(validated);
            }
        }

        cmd.arg(validated_text);

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        // Parse JSON output
        let stdout = String::from_utf8_lossy(&output.stdout);
        let embedding: Vec<f32> = serde_json::from_str(&stdout).map_err(|e| {
            Error::Io(std::io::Error::new(
                std::io::ErrorKind::InvalidData,
                format!(
                    "Failed to parse embedding response: {}. Response: {}",
                    e, stdout
                ),
            ))
        })?;

        Ok(EmbeddingResult {
            embedding,
            text: text.to_string(),
            model: config
                .and_then(|c| c.model.clone())
                .or_else(|| self.config.default_embedding_model.clone())
                .unwrap_or_else(|| "default".to_string()),
        })
    }

    /// Cluster documents
    pub fn cluster(
        &self,
        input: &str,
        num_clusters: usize,
        config: Option<&ClusterConfig>,
    ) -> Result<ClusterResult> {
        // Validate inputs
        let validated_input = validate_user_input(input)?;

        let mut cmd = Command::new(&self.config.binary_path);
        cmd.arg("cluster");
        cmd.arg("-n").arg(num_clusters.to_string());

        if let Some(cfg) = config {
            if let Some(ref m) = cfg.model {
                let validated = validate_model_name(m)?;
                cmd.arg("-m").arg(validated);
            }
            if cfg.summary {
                cmd.arg("--summary");
            }
        }

        cmd.arg(validated_input);

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        // Parse output - simplified for now
        Ok(ClusterResult {
            clusters: vec![],
            summaries: None,
        })
    }

    /// Perform similarity search
    pub fn similar(&self, query: &str, collection: &str, top_k: usize) -> Result<SimilarityResult> {
        // Validate inputs
        let validated_query = validate_user_input(query)?;
        let validated_collection = validate_collection_name(collection)?;

        let mut cmd = Command::new(&self.config.binary_path);
        cmd.arg("similar");
        cmd.arg("-c").arg(validated_collection);
        cmd.arg("-n").arg(top_k.to_string());
        cmd.arg(validated_query);

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        // Parse output - simplified for now
        Ok(SimilarityResult { matches: vec![] })
    }

    /// Execute a RAG pipeline
    pub fn rag(&self, query: &str, config: &RagConfig) -> Result<PromptResult> {
        // First, get similar documents
        let similar = self.similar(query, &config.collection, config.top_k)?;

        // Build context from matches
        let context: String = similar
            .matches
            .iter()
            .map(|m| m.content.clone())
            .collect::<Vec<_>>()
            .join("\n\n---\n\n");

        // Build RAG prompt
        let rag_prompt = format!(
            "Based on the following context, answer the question.\n\n\
             Context:\n{}\n\n\
             Question: {}",
            context, query
        );

        // Execute with optional system prompt
        if let Some(ref system) = config.system_prompt {
            self.prompt_with_system(&rag_prompt, system, config.model.as_deref())
        } else {
            self.prompt(&rag_prompt, config.model.as_deref())
        }
    }

    /// Execute a prompt using a template
    pub fn prompt_with_template(
        &self,
        template: &str,
        variables: &[(&str, &str)],
        model: Option<&str>,
    ) -> Result<PromptResult> {
        // Validate template name
        let validated_template = validate_template_name(template)?;
        let validated_model = match model {
            Some(m) => Some(validate_model_name(m)?),
            None => None,
        };

        let mut cmd = Command::new(&self.config.binary_path);
        cmd.arg("-t").arg(validated_template);

        if let Some(m) = validated_model.or(self.config.default_model.as_deref()) {
            cmd.arg("-m").arg(m);
        }

        // Add template variables as -p key value pairs
        for (key, value) in variables {
            // Validate variable names (alphanumeric + underscores)
            if !key
                .chars()
                .all(|c| c.is_alphanumeric() || c == '_' || c == '-')
            {
                return Err(Error::Validation(format!(
                    "Template variable name contains invalid characters: '{}'",
                    key
                )));
            }
            // Validate variable values
            let validated_value = validate_user_input(value)?;
            cmd.arg("-p").arg(*key).arg(validated_value);
        }

        let output = cmd.output().map_err(Error::Io)?;

        if !output.status.success() {
            return Err(Error::Io(std::io::Error::other(
                String::from_utf8_lossy(&output.stderr).to_string(),
            )));
        }

        Ok(PromptResult {
            response: String::from_utf8_lossy(&output.stdout).to_string(),
            model: validated_model
                .or(self.config.default_model.as_deref())
                .unwrap_or("default")
                .to_string(),
            tokens_used: None,
        })
    }
}

impl Default for LlmCliClient {
    fn default() -> Self {
        Self::new().expect("Failed to create default LlmCliClient")
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_validate_model_name_valid() {
        assert!(validate_model_name("gpt-4o-mini").is_ok());
        assert!(validate_model_name("claude-sonnet-4").is_ok());
        assert!(validate_model_name("sentence-transformers/all-MiniLM-L6-v2").is_ok());
        assert!(validate_model_name("model:latest").is_ok());
    }

    #[test]
    fn test_validate_model_name_invalid() {
        assert!(validate_model_name("").is_err());
        assert!(validate_model_name("model; rm -rf /").is_err());
        assert!(validate_model_name("model$(whoami)").is_err());
        assert!(validate_model_name("../../../etc/passwd").is_err());
    }

    #[test]
    fn test_validate_collection_name_valid() {
        assert!(validate_collection_name("my-collection").is_ok());
        assert!(validate_collection_name("collection_123").is_ok());
    }

    #[test]
    fn test_validate_collection_name_invalid() {
        assert!(validate_collection_name("").is_err());
        assert!(validate_collection_name("collection/path").is_err());
        assert!(validate_collection_name("col; drop table").is_err());
    }

    #[test]
    fn test_validate_db_path_valid() {
        assert!(validate_db_path("/home/user/.llm/db.sqlite").is_ok());
        assert!(validate_db_path("./data/embeddings.db").is_ok());
    }

    #[test]
    fn test_validate_db_path_invalid() {
        assert!(validate_db_path("").is_err());
        assert!(validate_db_path("/path/../../../etc/passwd").is_err());
        assert!(validate_db_path("/path$(whoami)/db").is_err());
        assert!(validate_db_path("/path`id`/db").is_err());
        assert!(validate_db_path("/path;rm -rf/db").is_err());
    }

    #[test]
    fn test_format_dangerous_char() {
        assert_eq!(format_dangerous_char('\n'), "\\n");
        assert_eq!(format_dangerous_char('\r'), "\\r");
        assert_eq!(format_dangerous_char('\0'), "\\0");
        assert_eq!(format_dangerous_char('$'), "$");
    }

    #[test]
    fn test_client_creation() {
        let client = LlmCliClient::new();
        assert!(client.is_ok());
    }

    #[test]
    fn test_config_default() {
        let config = LlmCliConfig::default();
        assert_eq!(config.binary_path, PathBuf::from("llm"));
        assert!(config.default_model.is_none());
    }
}