systemprompt_models/ai/
sampling.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4pub struct ModelPreferences {
5    pub hints: Vec<ModelHint>,
6    pub cost_priority: Option<f32>,
7}
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10#[serde(untagged)]
11pub enum ModelHint {
12    ModelId(String),
13    Category(String),
14    Provider(String),
15}
16
17#[derive(Debug, Clone, Default, Serialize, Deserialize)]
18pub struct SamplingParams {
19    pub temperature: Option<f32>,
20    pub top_p: Option<f32>,
21    pub top_k: Option<i32>,
22    pub presence_penalty: Option<f32>,
23    pub frequency_penalty: Option<f32>,
24    pub stop_sequences: Option<Vec<String>>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct ProviderConfig {
29    pub provider: String,
30    pub model: String,
31    pub max_output_tokens: u32,
32}
33
34impl ProviderConfig {
35    pub fn new(
36        provider: impl Into<String>,
37        model: impl Into<String>,
38        max_output_tokens: u32,
39    ) -> Self {
40        Self {
41            provider: provider.into(),
42            model: model.into(),
43            max_output_tokens,
44        }
45    }
46}