pub struct VlmClient {
inner: Client<OpenAIConfig>,
model: String,
}Expand description
Direct HTTP client for an OpenAI-compatible chat-completions endpoint.
Cheap to clone — async_openai::Client wraps a reqwest::Client (an
Arc<...> internally). No mutex needed when sharing across tasks.
Fields§
§inner: Client<OpenAIConfig>§model: StringImplementations§
Source§impl VlmClient
impl VlmClient
pub fn new(cfg: &VlmConfig) -> Self
Sourcepub async fn chat_stream(
&self,
messages: &[Message],
tools: &[ToolDef],
) -> Result<Pin<Box<dyn Stream<Item = Result<VlmStreamItem>> + Send>>>
pub async fn chat_stream( &self, messages: &[Message], tools: &[ToolDef], ) -> Result<Pin<Box<dyn Stream<Item = Result<VlmStreamItem>> + Send>>>
Open a streaming chat completion. Yields:
TextDeltafor every assistant content chunkToolCallonce per accumulated function call (after the upstream finishes streaming all argument deltas)- one final
Finish
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VlmClient
impl !RefUnwindSafe for VlmClient
impl Send for VlmClient
impl Sync for VlmClient
impl Unpin for VlmClient
impl UnsafeUnpin for VlmClient
impl !UnwindSafe for VlmClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].