crates/edge/server/src/capability.rs 2.9 KiB 108 lines Raw
1 //! The capability table of spec section 7.2 //!3 //! One table feeds the twelve routes and `GET /capabilities`. The table is4 //! static: it describes the engine's vocabulary, not the models that happen to5 //! be loaded. A key that is not here is not a capability, and a route that is6 //! not here is not a route.7 8 /// One row of the capability table.9 pub(crate) struct Row {10     /// The stable capability key.11     pub(crate) name: &'static str,12     /// The canonical HTTP route. It is not always derived from the key.13     pub(crate) route: &'static str,14     /// The part kinds that the capability accepts.15     pub(crate) parts: &'static [&'static str],16     /// The output channels that it can emit.17     pub(crate) channels: &'static [&'static str],18     /// Whether the capability streams.19     pub(crate) stream: bool,20 }21 22 /// The twelve capabilities, in the order that section 7 gives.23 pub(crate) const TABLE: [Row; 12] = [24     Row {25         name: "chat",26         route: "/chat",27         parts: &["text", "image", "audio", "json"],28         channels: &["text", "tokens", "decision", "progress"],29         stream: true,30     },31     Row {32         name: "embed",33         route: "/embed",34         parts: &["text"],35         channels: &["embedding"],36         stream: false,37     },38     Row {39         name: "rerank",40         route: "/rerank",41         parts: &["text", "json"],42         channels: &["embedding"],43         stream: false,44     },45     Row {46         name: "tts",47         route: "/tts",48         parts: &["text"],49         channels: &["pcm", "progress"],50         stream: true,51     },52     Row {53         name: "stt",54         route: "/stt",55         parts: &["audio", "text"],56         channels: &["text", "tokens", "progress"],57         stream: true,58     },59     Row {60         name: "music",61         route: "/music",62         parts: &["text", "audio"],63         channels: &["pcm", "progress"],64         stream: true,65     },66     Row {67         name: "image-gen",68         route: "/image/generate",69         parts: &["text", "image"],70         channels: &["image", "progress"],71         stream: true,72     },73     Row {74         name: "image-edit",75         route: "/image/edit",76         parts: &["image", "text"],77         channels: &["image", "progress"],78         stream: true,79     },80     Row {81         name: "t2v-gen",82         route: "/video/text-to-video",83         parts: &["text", "image"],84         channels: &["clip", "progress"],85         stream: true,86     },87     Row {88         name: "i2v-gen",89         route: "/video/image-to-video",90         parts: &["image", "text"],91         channels: &["clip", "progress"],92         stream: true,93     },94     Row {95         name: "decide",96         route: "/decide",97         parts: &["text", "json", "image"],98         channels: &["decision"],99         stream: false,100     },101     Row {102         name: "extract",103         route: "/extract",104         parts: &["text", "json"],105         channels: &["decision"],106         stream: false,107     },108 ];