dynamo_llm/
request_template.rs1use anyhow::Result;
5use serde::{Deserialize, Serialize};
6use std::path::Path;
7
8#[derive(Debug, Serialize, Deserialize, Clone)]
9pub struct RequestTemplate {
10 pub model: String,
11 pub temperature: f32,
12 pub max_completion_tokens: u32,
13}
14
15impl RequestTemplate {
16 pub fn load(path: &Path) -> Result<Self> {
17 let template = std::fs::read_to_string(path)?;
18 let template: Self = serde_json::from_str(&template)
19 .inspect_err(|err| crate::log_json_err(&path.display().to_string(), &template, err))?;
20 Ok(template)
21 }
22}