kernelx_core/capabilities/
structured.rs

1use super::HasCapability;
2use crate::{models::ModelConfig, Result};
3use async_trait::async_trait;
4use serde_json::Value;
5
6#[async_trait]
7pub trait Structured: HasCapability {
8    async fn structured_complete(&self, prompt: &str, schema: &Value) -> Result<Value> {
9        self.structured_impl(self.model_id(), prompt, schema, self.config())
10            .await
11    }
12
13    #[doc(hidden)]
14    async fn structured_impl(
15        &self,
16        model: &str,
17        prompt: &str,
18        schema: &Value,
19        config: &ModelConfig,
20    ) -> Result<Value>;
21}