pub struct Proxy<D: LlmDaemon + Debug> { /* private fields */ }
Expand description
A proxy to actual LLM server, and only send the last pending request. If the LLM generation is slower than requests, then processing the oldest request does not make sense, as the user is more interested in the later requests. But current server (AFAIK) does not handle this properly…
Implementations§
Trait Implementations§
Source§impl<D: LlmDaemon + Debug> LlmDaemon for Proxy<D>
impl<D: LlmDaemon + Debug> LlmDaemon for Proxy<D>
type Config = ProxyConfig
Source§fn fork_daemon(&self) -> Result<()>
fn fork_daemon(&self) -> Result<()>
Spawns the daemon, initializing any necessary resources or processes.
This method is expected to be called before creation of tokio runtime, mostly
due to the use of the
fork
. User is free to use async runtime after
calling this.Source§fn heartbeat<'a, 'b>(&'b self) -> impl Future<Output = Result<()>> + Send + 'awhere
'a: 'b,
fn heartbeat<'a, 'b>(&'b self) -> impl Future<Output = Result<()>> + Send + 'awhere
'a: 'b,
Creates a task which maintains a periodic heartbeat to the daemon.
Daemon is expected to terminate if there’s no heartbeat for a certain period of time.
Keeping this task within async runtime will ensure that the daemon is kept running
during the application.
FIXME: Extract heartbeat / ready to Async util?
fn config(&self) -> &Self::Config
Auto Trait Implementations§
impl<D> Freeze for Proxy<D>where
D: Freeze,
impl<D> RefUnwindSafe for Proxy<D>where
D: RefUnwindSafe,
impl<D> Send for Proxy<D>where
D: Send,
impl<D> Sync for Proxy<D>where
D: Sync,
impl<D> Unpin for Proxy<D>where
D: Unpin,
impl<D> UnwindSafe for Proxy<D>where
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more