Skip to main content

Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }
Expand description

A cloneable vllm.cpp serving engine.

Implementations§

Source§

impl Engine

Source

pub fn builder(model_path: impl Into<PathBuf>) -> EngineBuilder

Starts configuring an engine for a model directory or GGUF file.

Source

pub fn load(model_path: impl Into<PathBuf>) -> Result<Self, Error>

Loads an engine using native defaults.

Source

pub fn complete( &self, prompt: &str, params: &SamplingParams, ) -> Result<Completion, Error>

Runs one blocking text completion.

Source

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.

Source

pub fn chat_json(&self, request_json: &str) -> Result<String, Error>

Runs one blocking OpenAI-style chat request and returns response JSON.

Source

pub fn chat_stream_json<F>( &self, request_json: &str, callback: F, ) -> Result<StreamOutcome, Error>

Runs one blocking OpenAI-style streaming chat request.

Source

pub fn chat(&self, request: &Value) -> Result<Value, Error>

Source§

impl Engine

Source

pub fn submit<F>( &self, prompt: &str, params: &SamplingParams, callback: F, ) -> Result<Request, Error>
where F: FnMut(StreamEvent) -> StreamControl + Send + 'static,

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§

Source§

impl Clone for Engine

Source§

fn clone(&self) -> Engine

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Engine

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V