llm_trait/
capabilities.rs1#[derive(Clone, Debug, Default)]
5pub struct Capabilities {
6 pub supports_streaming: bool,
8 pub supports_tools: bool,
10 pub supports_vision: bool,
12 pub supports_thinking: bool,
14 pub max_context_tokens: Option<u32>,
16 pub max_output_tokens: Option<u32>,
18}
19
20#[derive(Clone, Debug)]
22pub struct ProviderInfo {
23 pub name: String,
25 pub model: String,
27 pub version: Option<String>,
29}
30
31#[cfg(test)]
32mod tests {
33 use super::*;
34
35 #[test]
36 fn capabilities_default() {
37 let caps = Capabilities::default();
38 assert!(!caps.supports_streaming);
39 assert!(!caps.supports_tools);
40 assert!(!caps.supports_vision);
41 assert!(!caps.supports_thinking);
42 assert!(caps.max_context_tokens.is_none());
43 assert!(caps.max_output_tokens.is_none());
44 }
45
46 #[test]
47 fn capabilities_clone() {
48 let caps = Capabilities {
49 supports_streaming: true,
50 supports_tools: true,
51 supports_vision: false,
52 supports_thinking: true,
53 max_context_tokens: Some(128_000),
54 max_output_tokens: Some(16_384),
55 };
56 let cloned = caps.clone();
57 assert!(cloned.supports_streaming);
58 assert!(cloned.supports_tools);
59 assert!(!cloned.supports_vision);
60 assert!(cloned.supports_thinking);
61 assert_eq!(cloned.max_context_tokens, Some(128_000));
62 assert_eq!(cloned.max_output_tokens, Some(16_384));
63 }
64
65 #[test]
66 fn provider_info_debug() {
67 let info = ProviderInfo {
68 name: "openai".to_string(),
69 model: "gpt-4o".to_string(),
70 version: None,
71 };
72 let debug = format!("{:?}", info);
73 assert!(debug.contains("openai"));
74 assert!(debug.contains("gpt-4o"));
75 }
76}