pub struct Engine { /* private fields */ }Expand description
A cloneable vllm.cpp serving engine.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn builder(model_path: impl Into<PathBuf>) -> EngineBuilder
pub fn builder(model_path: impl Into<PathBuf>) -> EngineBuilder
Starts configuring an engine for a model directory or GGUF file.
Sourcepub fn load(model_path: impl Into<PathBuf>) -> Result<Self, Error>
pub fn load(model_path: impl Into<PathBuf>) -> Result<Self, Error>
Loads an engine using native defaults.
Sourcepub fn complete(
&self,
prompt: &str,
params: &SamplingParams,
) -> Result<Completion, Error>
pub fn complete( &self, prompt: &str, params: &SamplingParams, ) -> Result<Completion, Error>
Runs one blocking text completion.
Sourcepub fn complete_stream<F>(
&self,
prompt: &str,
params: &SamplingParams,
callback: F,
) -> Result<StreamOutcome, Error>
pub fn complete_stream<F>( &self, prompt: &str, params: &SamplingParams, callback: F, ) -> Result<StreamOutcome, Error>
Runs one blocking streaming text completion.
A callback panic is resumed only after native code has aborted the request and returned across the FFI boundary.
Sourcepub fn chat_json(&self, request_json: &str) -> Result<String, Error>
pub fn chat_json(&self, request_json: &str) -> Result<String, Error>
Runs one blocking OpenAI-style chat request and returns response JSON.
Sourcepub fn chat_stream_json<F>(
&self,
request_json: &str,
callback: F,
) -> Result<StreamOutcome, Error>
pub fn chat_stream_json<F>( &self, request_json: &str, callback: F, ) -> Result<StreamOutcome, Error>
Runs one blocking OpenAI-style streaming chat request.
pub fn chat(&self, request: &Value) -> Result<Value, Error>
Source§impl Engine
impl Engine
Sourcepub fn submit<F>(
&self,
prompt: &str,
params: &SamplingParams,
callback: F,
) -> Result<Request, Error>
pub fn submit<F>( &self, prompt: &str, params: &SamplingParams, callback: F, ) -> Result<Request, Error>
Submits a non-blocking streaming completion to the shared engine.
The callback runs on a native delivery thread and receives an owned UTF-8
copy of each delta. A callback panic is contained and later reported by
Request::wait as Error::CallbackPanicked.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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