Machine Learning
Every registered machine learning instance operation, with source-derived inputs, outputs, access policy, and errors.
This reference covers 9 HTTP operations registered by the Akasha daemon. Call these paths on your instance base URL. See authentication, errors, and coverage before integrating.
| Method | Path | Operation |
|---|---|---|
POST | /v1/ml/models/load | Ml models load |
POST | /v1/ml/models/unload | Ml models unload |
GET | /v1/ml/models | Ml models list |
POST | /v1/ml/metrics | Ml metrics |
POST | /v1/ml/embed | Ml embed |
POST | /v1/ml/generate | Ml generate |
POST | /v1/ml/tokenizers/load | Ml tokenizer load |
POST | /v1/ml/train/supervised | Ml train supervised http |
POST | /v1/ml/train/hrm | Ml train hrm http |
POST /v1/ml/models/load
Ml models load
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — LoadModelRequest
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
name | String | Yes | |
model_type | String | Yes | |
framework | String | Yes | |
path | Option<String> | No; optional or defaulted | |
data_b64 | Option<String> | No; optional or defaulted |
struct LoadModelRequest {
name: String,
model_type: String,
framework: String,
path: Option<String>,
data_b64: Option<String>,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"id": id})serde_json::json!({"id": id})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2650. Registration: akasha-daemon/src/main.rs:4556.
POST /v1/ml/models/unload
Ml models unload
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — UnloadModelRequest
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
id | String | Yes |
struct UnloadModelRequest {
id: String,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"ok": true})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2685. Registration: akasha-daemon/src/main.rs:4557.
GET /v1/ml/models
Ml models list
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
No typed JSON, query, or path extractor is declared in the handler signature. Headers or request objects may still be consumed; the signature below is authoritative.
Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"models": db.ml_list_loaded_models()}),Errors and validation
Directly referenced error variants: none in the handler body. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2697. Registration: akasha-daemon/src/main.rs:4558.
POST /v1/ml/metrics
Ml metrics
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — MlMetricsRequest
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
model_id | String | Yes |
struct MlMetricsRequest {
model_id: String,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"metrics": m})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2712. Registration: akasha-daemon/src/main.rs:4559.
POST /v1/ml/embed
Ml embed
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — EmbedRequest
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
text | String | Yes | |
chunk | bool | No; optional or defaulted | When true, long text is automatically chunked and each chunk is embedded separately. The response contains a vectors array instead of a single vector. Serde: default |
chunking | Option<chunking::ChunkingConfig> | No; optional or defaulted | Optional per-request chunking overrides. |
struct EmbedRequest {
text: String,
/// When true, long text is automatically chunked and each chunk is
/// embedded separately. The response contains a `vectors` array instead
/// of a single `vector`.
#[serde(default)]
chunk: bool,
/// Optional per-request chunking overrides.
chunking: Option<chunking::ChunkingConfig>,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"vector": v, "chunks": 1})serde_json::json!({
"vectors": vectors,
"chunks": chunks.len(),
})serde_json::json!({"vector": v})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2737. Registration: akasha-daemon/src/main.rs:4560.
POST /v1/ml/generate
Ml generate
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — MlGenerateRequest
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
model_id | String | Yes | |
prompt | String | Yes | |
max_tokens | Option<usize> | No; optional or defaulted | |
temperature | Option<f32> | No; optional or defaulted |
struct MlGenerateRequest {
model_id: String,
prompt: String,
max_tokens: Option<usize>,
temperature: Option<f32>,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"text": text})Errors and validation
Directly referenced error variants: InvalidRequest, ServiceDisabled. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2829. Registration: akasha-daemon/src/main.rs:4561.
POST /v1/ml/tokenizers/load
Ml tokenizer load
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — MlTokenizerLoadReq
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
model_id | String | Yes |
struct MlTokenizerLoadReq {
model_id: String,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"ok": true})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2862. Registration: akasha-daemon/src/main.rs:4562.
POST /v1/ml/train/supervised
Ml train supervised http
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions. |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — MlTrainSupervisedReq
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
model_name | String | Yes | |
input_dim | usize | Yes | |
num_classes | usize | Yes | |
samples | Vec<MlSupervisedSample> | Yes | |
params | MlTrainingParams | No; optional or defaulted | Serde: default |
struct MlTrainSupervisedReq {
model_name: String,
input_dim: usize,
num_classes: usize,
samples: Vec<MlSupervisedSample>,
#[serde(default)]
params: MlTrainingParams,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({
"model_id": info.id,
"name": info.name,
"version": info.version,
"metrics": info.metrics,
})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:2972. Registration: akasha-daemon/src/main.rs:4563.
POST /v1/ml/train/hrm
Ml train hrm http
| Availability | Source contract |
|---|---|
| Registration | config.enable_ml |
| Runtime service | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | Cognitive |
Access: Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.
Request
Json — MlTrainHrmReq
| Field | Rust type | Required on input | Notes |
|---|---|---|---|
domain | String | Yes | |
dataspace | String | Yes | |
primitive_keyspace | String | Yes | |
checkpoint_name | String | Yes | |
reservoir_id | Option<String> | No; optional or defaulted | Serde: default |
epochs | Option<usize> | No; optional or defaulted | Serde: default |
batch_size | Option<usize> | No; optional or defaulted | Serde: default |
model_config | serde_json::Value | Yes | |
training_config | serde_json::Value | Yes | |
inputs | Option<Vec<serde_json::Value>> | No; optional or defaulted | Serde: default |
targets | Option<Vec<serde_json::Value>> | No; optional or defaulted | Serde: default |
struct MlTrainHrmReq {
domain: String,
dataspace: String,
primitive_keyspace: String,
checkpoint_name: String,
#[serde(default)]
reservoir_id: Option<String>,
#[serde(default)]
epochs: Option<usize>,
#[serde(default)]
batch_size: Option<usize>,
model_config: serde_json::Value,
training_config: serde_json::Value,
#[serde(default)]
#[allow(dead_code)]
inputs: Option<Vec<serde_json::Value>>,
#[serde(default)]
#[allow(dead_code)]
targets: Option<Vec<serde_json::Value>>,
}Response
Declared return: Result<impl IntoResponse, DaemonError>
The following are the exact JSON construction expressions in the handler. Values such as rows, result, and delegated types are runtime values, not literal example payloads.
serde_json::json!({"status": "ok"})Errors and validation
Directly referenced error variants: InvalidRequest. Middleware and delegated services can return additional errors described in the shared error reference.
Source: akasha-daemon/src/main.rs:3025. Registration: akasha-daemon/src/main.rs:4564.