Skip to main content

rskit_ai/
model.rs

1//! Provider and model identity vocabulary.
2
3use serde::{Deserialize, Serialize};
4
5/// Provider identifier for a model.
6#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
7#[serde(rename_all = "snake_case")]
8#[non_exhaustive]
9pub enum Provider {
10    /// OpenAI.
11    OpenAI,
12    /// Anthropic.
13    Anthropic,
14    /// Google Gemini/Vertex.
15    Google,
16    /// Cohere.
17    Cohere,
18    /// Mistral.
19    Mistral,
20    /// Meta-hosted or Meta-native model family.
21    Meta,
22    /// AWS Bedrock.
23    AWSBedrock,
24    /// Azure OpenAI.
25    AzureOpenAI,
26    /// Ollama.
27    Ollama,
28    /// NVIDIA Triton.
29    Triton,
30    /// vLLM.
31    Vllm,
32    /// Hugging Face Text Generation Inference.
33    Tgi,
34    /// Unknown or private provider name.
35    Custom(String),
36}
37
38/// Model capability declaration.
39#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
40pub struct Capabilities {
41    /// Whether streaming responses are supported.
42    pub streaming: bool,
43    /// Whether image inputs are supported.
44    pub vision: bool,
45    /// Whether audio inputs are supported.
46    pub audio: bool,
47    /// Whether tool use/function calling is supported.
48    pub tool_use: bool,
49    /// Whether JSON-mode/structured generation is supported.
50    pub json_mode: bool,
51    /// Whether reasoning token accounting is supported.
52    pub reasoning_tokens: bool,
53    /// Maximum input tokens accepted by the model.
54    #[serde(default, skip_serializing_if = "Option::is_none")]
55    pub max_input_tokens: Option<u64>,
56    /// Maximum output tokens generated by the model.
57    #[serde(default, skip_serializing_if = "Option::is_none")]
58    pub max_output_tokens: Option<u64>,
59}
60
61/// Canonical model identity.
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
63pub struct Model {
64    /// Model name/identifier.
65    pub name: String,
66    /// Provider that serves the model.
67    pub provider: Provider,
68    /// Optional provider model version.
69    #[serde(default, skip_serializing_if = "Option::is_none")]
70    pub version: Option<String>,
71    /// Model capabilities.
72    pub capabilities: Capabilities,
73}