embedded_llm/
lib.rs

1#![no_std]
2
3use core::ops::Deref;
4
5use embedded_io::ErrorType;
6use futures_core::Stream;
7pub trait LLMMut: ErrorType {
8    fn start(&mut self, system: &str)
9    -> Result<impl LLMInstance<Error = Self::Error>, Self::Error>;
10}
11pub trait LLMRef: ErrorType {
12    fn start(&self, system: &str) -> Result<impl LLMInstance<Error = Self::Error>, Self::Error>;
13}
14pub trait LLMInstance: ErrorType {
15    fn send(
16        &mut self,
17        user: impl Iterator<Item: Deref<Target = str>>,
18    ) -> Result<impl embedded_io::Read<Error = Self::Error>, Self::Error>;
19}
20pub trait AsyncLLMMut: ErrorType {
21    async fn start(
22        &mut self,
23        system: &str,
24    ) -> Result<impl AsyncLLMInstance<Error = Self::Error>, Self::Error>;
25}
26pub trait AsyncLLMRef: ErrorType {
27    async fn start(
28        &self,
29        system: &str,
30    ) -> Result<impl AsyncLLMInstance<Error = Self::Error>, Self::Error>;
31}
32pub trait AsyncLLMInstance: ErrorType {
33    async fn send(
34        &mut self,
35        user: impl Stream<Item: Deref<Target = str>>,
36    ) -> Result<impl embedded_io_async::Read<Error = Self::Error>, Self::Error>;
37}