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
//! Capability flags advertised by provider implementations.
use serde::{Deserialize, Serialize};
/// Describes which features a provider can serve.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProviderCapabilities {
/// Provider can return a complete chat response.
pub chat: bool,
/// Provider can stream chat events.
pub chat_stream: bool,
/// Provider accepts tool definitions in chat requests.
pub tool_calling: bool,
/// Provider can execute or request multiple tool calls concurrently.
pub parallel_tool_calls: bool,
/// Provider can constrain output with a JSON schema.
pub json_schema_output: bool,
/// Provider can consume image content.
pub vision: bool,
/// Provider can produce embeddings.
pub embeddings: bool,
/// Maximum supported input tokens, when known.
pub max_input_tokens: Option<u32>,
/// Maximum supported output tokens, when known.
pub max_output_tokens: Option<u32>,
}
impl ProviderCapabilities {
/// Returns a capability set for basic non-streaming chat providers.
#[must_use]
pub const fn chat() -> Self {
Self {
chat: true,
..Self::empty()
}
}
/// Returns a capability set for embedding-only providers.
#[must_use]
pub const fn embeddings() -> Self {
Self {
embeddings: true,
..Self::empty()
}
}
/// Returns an empty capability set.
#[must_use]
pub const fn empty() -> Self {
Self {
chat: false,
chat_stream: false,
tool_calling: false,
parallel_tool_calls: false,
json_schema_output: false,
vision: false,
embeddings: false,
max_input_tokens: None,
max_output_tokens: None,
}
}
}