Skip to main content

feagi_api/v1/
physiology_dtos.rs

1// Copyright 2025 Neuraville Inc.
2// Licensed under the Apache License, Version 2.0
3
4//! Physiology API DTOs
5//!
6//! Request/response types for physiology parameter management
7
8use serde::{Deserialize, Serialize};
9use std::collections::HashMap;
10use utoipa::ToSchema;
11
12/// Response containing physiology parameters
13#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
14pub struct PhysiologyResponse {
15    /// Physiology parameters
16    pub physiology: PhysiologyParameters,
17}
18
19/// Physiology parameters
20#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
21pub struct PhysiologyParameters {
22    /// Simulation timestep in seconds
23    pub simulation_timestep: f64,
24
25    /// Maximum neuron age
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub max_age: Option<u32>,
28
29    /// Evolution burst count
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub evolution_burst_count: Option<u64>,
32
33    /// IPU idle threshold
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub ipu_idle_threshold: Option<u32>,
36
37    /// Plasticity queue depth
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub plasticity_queue_depth: Option<u32>,
40
41    /// Lifespan management interval
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub lifespan_mgmt_interval: Option<u32>,
44
45    /// Sleep trigger inactivity window
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub sleep_trigger_inactivity_window: Option<u32>,
48
49    /// Sleep trigger neural activity max
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub sleep_trigger_neural_activity_max: Option<f64>,
52
53    /// Quantization precision for numeric values
54    /// Options: "fp32" (default), "fp16", "int8"
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub quantization_precision: Option<String>,
57}
58
59/// Request to update physiology parameters
60#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
61pub struct PhysiologyUpdateRequest {
62    /// Physiology parameters to update
63    pub physiology: HashMap<String, serde_json::Value>,
64}
65
66/// Response for physiology update
67#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
68pub struct PhysiologyUpdateResponse {
69    pub success: bool,
70    pub updated: HashMap<String, serde_json::Value>,
71    #[serde(skip_serializing_if = "Option::is_none")]
72    pub message: Option<String>,
73}