Skip to main content

FakeProvider

Struct FakeProvider 

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

In-memory fake provider fixture for SDK conformance tests. Use it to script deterministic behavior in memory; any transcript or endpoint mutation is documented on the method that performs it.

Implementations§

Source§

impl FakeProvider

Source

pub fn with_responses( responses: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Returns this value with its responses setting replaced. The method follows builder-style data construction and does not execute external work.

Source

pub fn requests(&self) -> Vec<ProviderRequest>

Returns the requests currently held by this value. This configures deterministic in-memory test state only.

Trait Implementations§

Source§

impl Clone for FakeProvider

Source§

fn clone(&self) -> FakeProvider

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 FakeProvider

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FakeProvider

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ProviderAdapter for FakeProvider

Source§

fn capabilities(&self) -> ProviderCapabilities

Returns adapter capability metadata for policy and package resolution. This is data-only and does not perform I/O, call host ports, append journals, publish events, or start processes.
Source§

fn complete( &self, request: &ProviderRequest, ) -> Result<ProviderResponse, AgentError>

Calls the provider for one non-streaming completion request. Implementations may call the model provider; caller-owned runtime code must handle policy, journaling, and event publication around it.
Source§

fn project_request( &self, projection: &ContextProjection, policy: &ProviderProjectionPolicy, ) -> Result<ProviderRequest, AgentError>

Projects admitted context into the provider’s request shape. This projects admitted context into a provider request and must not fetch hidden raw content.
Source§

fn stream( &self, request: &ProviderRequest, ) -> Result<Vec<ProviderStreamChunk>, AgentError>

Calls the provider for a streaming response. Implementations may call the model provider; caller-owned runtime code must handle policy, journaling, and event publication around it.
Source§

fn extract_usage(&self, response: &ProviderResponse) -> ProviderUsage

Extracts provider usage accounting from a response. This derives usage accounting from a provider response and performs no provider call.

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<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> Same for T

Source§

type Output = T

Should always be Self
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.