rusty_genius_core/
manifest.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct UserManifest {
5 pub name: String,
6 pub model: String,
7 }
9
10impl Default for UserManifest {
11 fn default() -> Self {
12 Self {
13 name: "default".to_string(),
14 model: "llama-2-7b".to_string(),
15 }
16 }
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct ModelSpec {
21 pub repo: String,
22 pub filename: String,
23 pub quantization: String,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct InferenceConfig {
28 pub temperature: f32,
29 pub top_p: Option<f32>,
30 pub top_k: Option<u32>,
31 pub repetition_penalty: Option<f32>,
32 pub max_tokens: Option<usize>,
33}
34
35impl Default for InferenceConfig {
36 fn default() -> Self {
37 Self {
38 temperature: 0.7,
39 top_p: Some(0.9),
40 top_k: Some(40),
41 repetition_penalty: Some(1.1),
42 max_tokens: None,
43 }
44 }
45}
46
47impl UserManifest {
48 pub fn merge(&self, other: &Self) -> Self {
49 Self {
50 name: if !other.name.is_empty() && other.name != "default" {
51 other.name.clone()
52 } else {
53 self.name.clone()
54 },
55 model: if !other.model.is_empty() {
56 other.model.clone()
57 } else {
58 self.model.clone()
59 },
60 }
61 }
62}