pub struct Daemon { /* private fields */ }Implementations§
Source§impl Daemon
impl Daemon
pub fn new( store: SessionStore, host: EngineHost, codec: Box<dyn TextCodec + Send + Sync>, max_lanes: usize, ) -> Daemon
pub fn with_park( store: SessionStore, host: EngineHost, codec: Box<dyn TextCodec + Send + Sync>, max_lanes: usize, park_dir: Option<PathBuf>, ) -> Daemon
pub fn with_options( store: SessionStore, host: EngineHost, codec: Box<dyn TextCodec + Send + Sync>, opts: DaemonOptions, ) -> Result<Daemon, DaemonError>
pub fn reload_with( &self, build: impl FnOnce() -> Result<(EngineHost, Box<dyn TextCodec + Send + Sync>), DaemonError>, ) -> Result<(), DaemonError>
pub fn on_retired(&self, reload: Box<dyn Fn() + Send + Sync>)
pub fn max_stream_tokens(&self) -> u64
pub fn session_fits( &self, session: u64, thinking: Option<bool>, ) -> Result<(), DaemonError>
pub fn fim_fits(&self, req: &FimRequest) -> Result<(), DaemonError>
pub fn complete( &self, prefix: &str, suffix: &str, mode: u8, max_tokens: u32, ) -> Result<Completion, DaemonError>
pub fn complete_streaming( &self, req: &FimRequest, on_text: impl FnMut(&str, usize) -> ControlFlow<()>, ) -> Result<Completion, DaemonError>
pub fn attach_fim_satellite( &self, name: impl Into<String>, satellite: Arc<Daemon>, ) -> Result<(), DaemonError>
pub fn fim_satellite_name(&self) -> Option<String>
pub fn fim_satellite(&self) -> Option<Arc<Daemon>>
pub fn fim_supported(&self) -> bool
pub fn completion_bucket(&self) -> BucketConfig
pub fn note_completion_throttled(&self)
pub fn generate_tokens( &self, stream: Vec<u32>, params: GenParams, max_tokens: u32, deadline_ms: u64, ) -> Result<(Vec<u32>, bool), DaemonError>
pub fn generate_tokens_streaming( &self, stream: Vec<u32>, params: GenParams, max_tokens: u32, deadline_ms: u64, extras: GenExtras, on_tokens: impl FnMut(&[u32]) -> ControlFlow<()>, ) -> Result<(Vec<u32>, u32, bool), DaemonError>
pub fn forward_stage( &self, tokens: Vec<u32>, start_layer: u32, end_layer: u32, hidden_in: Option<Vec<u8>>, ) -> Result<StageOutput, DaemonError>
pub fn generate_tokens_constrained( &self, stream: Vec<u32>, params: GenParams, max_tokens: u32, deadline_ms: u64, json_schema: &str, ) -> Result<(Vec<u32>, bool), DaemonError>
pub fn put_media(&self, bytes: &[u8]) -> Result<String, DaemonError>
pub fn media_pool(&self) -> &MediaPool
pub fn append_image( &self, session: u64, role: u32, blob: &str, pre_text: &str, post_text: &str, ) -> Result<CommittedEvent, DaemonError>
pub fn gc_media(&self) -> Result<(usize, usize), DaemonError>
pub fn speculation(&self) -> Option<SpeculationGrant>
pub fn tool_lease_ms(&self) -> u64
pub fn inspect(&self, session: u64) -> Result<Inspection, DaemonError>
pub fn files(&self) -> &FileStore
pub fn batches(&self) -> Arc<BatchStore> ⓘ
pub fn responses(&self) -> &ResponseStore
pub fn tokenize(&self, text: &str) -> Vec<u32>
pub fn grammar_create(&self, json_schema: &str) -> Result<u32, DaemonError>
pub fn grammar_free(&self, grammar_handle: u32)
pub fn logit_bias_create( &self, tokens: &[i32], values: &[f32], ) -> Result<u32, DaemonError>
pub fn logit_bias_free(&self, handle: u32)
pub fn lora_load( &self, adapter_path: &str, ) -> Result<Option<String>, DaemonError>
pub fn lora_unload(&self) -> Result<Option<String>, DaemonError>
pub fn lora_id(&self) -> Result<Option<String>, DaemonError>
pub fn try_model_sampling_defaults(&self) -> Option<ModelSamplingDefaults>
pub fn model_sampling_defaults(&self) -> ModelSamplingDefaults
pub fn capability_descriptor(&self) -> Option<Value>
pub fn runtime_id(&self) -> Option<&'static str>
pub fn needs_reload(&self) -> Option<String>
pub fn capabilities(&self) -> Capabilities
pub fn require( &self, section: &str, key: &str, code: &'static str, param: Option<&str>, what: &str, ) -> Result<(), DaemonError>
pub fn chat_template(&self) -> Option<String>
pub fn transcribe( &self, audio_path: &str, params: &TranscribeParams, ) -> Result<Transcription, DaemonError>
pub fn transcribe_as( &self, audio_path: &str, params: &TranscribeParams, class: Option<u8>, ) -> Result<Transcription, DaemonError>
pub fn transcribe_streaming( &self, audio_path: &str, params: &TranscribeParams, ) -> Result<(Receiver<TranscribeSegmentMsg>, Receiver<Result<Transcription, DaemonError>>), DaemonError>
pub fn transcribe_streaming_as( &self, audio_path: &str, params: &TranscribeParams, class: Option<u8>, ) -> Result<(Receiver<TranscribeSegmentMsg>, Receiver<Result<Transcription, DaemonError>>), DaemonError>
pub fn embed(&self, text: &str) -> Result<Vec<f32>, DaemonError>
pub fn embed_as( &self, text: &str, class: Option<u8>, ) -> Result<Vec<f32>, DaemonError>
pub fn detokenize(&self, tokens: &[u32]) -> String
pub fn metrics_text(&self) -> String
pub fn set_background_tick_divisor(&self, divisor: u32)
pub fn set_qos( &self, session: u64, class: u8, batch_invariant: bool, ) -> Result<CommittedEvent, DaemonError>
pub fn sched_stats(&self) -> Arc<SchedStats> ⓘ
pub fn cancel_registry(&self) -> Arc<CancelSet> ⓘ
pub fn active_registry(&self) -> Arc<Mutex<HashSet<u64>>> ⓘ
pub fn store(&self) -> Arc<Mutex<SessionStore>> ⓘ
pub fn bus(&self) -> Arc<SessionBus> ⓘ
pub fn shutdown(&self)
pub fn signal_shutdown(&self)
pub fn create( &self, parent: Option<u64>, params: GenParams, ) -> Result<u64, DaemonError>
pub fn fork( &self, parent: u64, at_event: u64, params: Option<GenParams>, ) -> Result<u64, DaemonError>
pub fn tree(&self) -> Vec<(u64, Option<u64>, u64)>
pub fn sessions(&self, include_archived: bool) -> Vec<SessionSummary>
pub fn set_meta( &self, session: u64, expected_version: u64, title: Option<String>, archived: Option<bool>, ) -> Result<u64, DaemonError>
pub fn rebase( &self, parent: u64, edits: Vec<RebaseEdit>, params: Option<GenParams>, ) -> Result<u64, DaemonError>
pub fn trim(&self, session: u64, to_event: u64) -> Result<u64, DaemonError>
pub fn pin(&self, session: u64, ttl_ms: u64) -> Result<u64, DaemonError>
pub fn pin_prefix( &self, anchor: Option<u64>, stream: &[u32], upto: usize, ttl_ms: u64, ) -> Result<u64, DaemonError>
pub fn pinned_prefix_tokens( &self, stream: &[u32], uptos: &[usize], ) -> Result<u64, DaemonError>
pub fn unanchor_pins(&self, session: u64)
pub fn purge( &self, session: u64, expected_generation: u64, mode: PurgeMode, ) -> Result<Vec<u64>, DaemonError>
pub fn append( &self, session: u64, text: Option<String>, span: Vec<u32>, ) -> Result<CommittedEvent, DaemonError>
pub fn append_message( &self, session: u64, role: u32, text: String, ) -> Result<CommittedEvent, DaemonError>
pub fn renders_per_message(&self) -> bool
pub fn append_system_full( &self, session: u64, system: Option<String>, tool_jsons: Vec<String>, kwargs: &Map<String, Value>, ) -> Result<CommittedEvent, DaemonError>
pub fn append_system( &self, session: u64, system: Option<String>, tools: Vec<String>, ) -> Result<CommittedEvent, DaemonError>
pub fn supports_reasoning_effort(&self) -> bool
pub fn reasoning_effort_levels(&self) -> Vec<&'static str>
pub fn supports_enable_thinking(&self) -> bool
pub fn validate_template_kwargs( &self, kwargs: &Map<String, Value>, ) -> Result<(), String>
pub fn append_conversation( &self, session: u64, messages: &[ChatMessage], tools: &[String], kwargs: &Map<String, Value>, ) -> Result<CommittedEvent, DaemonError>
pub fn response_format_tag(&self, json_schema: &str) -> Option<String>
pub fn tool_structural_tag( &self, tool_jsons: &[String], at_least_one: bool, ) -> Option<String>
pub fn grammar_create_structural( &self, tag_json: &str, ) -> Result<u32, DaemonError>
pub fn parse_tool_call(&self, raw: &str) -> Option<(String, String)>
pub fn named_tool_call(&self, raw: &str) -> Option<(String, String)>
pub fn parse_tool_call_with( &self, raw: &str, schemas: Option<&ToolSchemas>, ) -> Option<(String, String)>
pub fn tool_fragment_mode(&self) -> ToolFragmentMode
pub fn tool_call_grammar(&self, tool_jsons: &[String]) -> Option<String>
pub fn append_system_with_tools( &self, session: u64, system: Option<String>, tool_jsons: Vec<String>, ) -> Result<CommittedEvent, DaemonError>
Sourcepub fn append_assistant_with_tool_calls(
&self,
session: u64,
content: String,
calls: Vec<(String, String)>,
after_query: bool,
) -> Result<CommittedEvent, DaemonError>
pub fn append_assistant_with_tool_calls( &self, session: u64, content: String, calls: Vec<(String, String)>, after_query: bool, ) -> Result<CommittedEvent, DaemonError>
after_query: no user query follows this turn in the conversation
(a step of a tool loop), which some templates render differently.
pub fn append_tool_result( &self, session: u64, call_id: u64, content: String, ) -> Result<CommittedEvent, DaemonError>
pub fn append_block( &self, session: u64, role: u32, kind: u32, payload: String, ) -> Result<CommittedEvent, DaemonError>
pub fn request_permission( &self, session: u64, call_id: u64, text: String, ) -> Result<CommittedEvent, DaemonError>
pub fn respond_permission( &self, session: u64, request_id: u64, granted: bool, ) -> Result<CommittedEvent, DaemonError>
pub fn request_tool_cancel( &self, session: u64, call_id: u64, ) -> Result<CommittedEvent, DaemonError>
pub fn append_tool_outcome( &self, session: u64, call_id: u64, outcome: u8, note: String, ) -> Result<CommittedEvent, DaemonError>
pub fn ledger( &self, session: u64, ) -> Result<Vec<(u64, LedgerEntry)>, DaemonError>
pub fn append_tool_history( &self, session: u64, content: String, ) -> Result<CommittedEvent, DaemonError>
pub fn open_tool_calls( &self, session: u64, ) -> Result<Vec<(u64, String, String)>, DaemonError>
pub fn generate( &self, session: u64, max_tokens: u32, ) -> Result<GenerateOutcome, DaemonError>
pub fn generate_streaming( &self, session: u64, max_tokens: u32, on_event: impl FnMut(&CommittedEvent) -> Result<(), DaemonError>, ) -> Result<GenerateOutcome, DaemonError>
pub fn generate_streaming_ex( &self, session: u64, max_tokens: u32, extras: GenExtras, on_event: impl FnMut(&CommittedEvent) -> Result<(), DaemonError>, ) -> Result<GenerateOutcome, DaemonError>
pub fn generate_streaming_ex_lp( &self, session: u64, max_tokens: u32, extras: GenExtras, on_event: impl FnMut(&CommittedEvent) -> Result<(), DaemonError>, on_logprobs: impl FnMut(&[TokenLogprob]), ) -> Result<GenerateOutcome, DaemonError>
pub fn generate_streaming_delta( &self, session: u64, max_tokens: u32, extras: GenExtras, on_event: impl FnMut(&CommittedEvent) -> Result<(), DaemonError>, on_logprobs: impl FnMut(&[TokenLogprob]), on_delta: impl FnMut(u32, &str, u32), ) -> Result<GenerateOutcome, DaemonError>
pub fn read( &self, session: u64, cursor: u64, ) -> Result<Vec<CommittedEvent>, DaemonError>
pub fn session_ids(&self) -> Vec<u64>
Auto Trait Implementations§
impl !Freeze for Daemon
impl !RefUnwindSafe for Daemon
impl !UnwindSafe for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnsafeUnpin for Daemon
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more