pub struct HttpAgent { /* private fields */ }Available on crate features
client and http only.Expand description
An HTTP endpoint and reusable connection settings. Create independent local
conversations with HttpAgent::thread, or consume raw events with run_events.
Implementations§
Source§impl HttpAgent
impl HttpAgent
Sourcepub fn new(url: impl AsRef<str>) -> Result<Self>
pub fn new(url: impl AsRef<str>) -> Result<Self>
Connect to url using default settings. No request is made yet.
Sourcepub fn from_transport(transport: HttpTransport) -> Self
pub fn from_transport(transport: HttpTransport) -> Self
Use a caller-configured HTTP transport.
Sourcepub fn builder(url: impl AsRef<str>) -> HttpAgentBuilder
pub fn builder(url: impl AsRef<str>) -> HttpAgentBuilder
Configure headers, timeouts and the underlying HTTP client.
Sourcepub fn thread(&self, id: impl Into<ThreadId>) -> Thread<HttpTransport>
pub fn thread(&self, id: impl Into<ThreadId>) -> Thread<HttpTransport>
An independent local conversation. This does not retrieve remote history.
Sourcepub fn thread_with_state<S: Serialize + DeserializeOwned>(
&self,
id: impl Into<ThreadId>,
state: S,
) -> Result<Thread<HttpTransport, S>>
pub fn thread_with_state<S: Serialize + DeserializeOwned>( &self, id: impl Into<ThreadId>, state: S, ) -> Result<Thread<HttpTransport, S>>
Initialize a typed conversation using a serializable state value.
Sourcepub fn thread_builder<S>(
&self,
id: impl Into<ThreadId>,
) -> ThreadBuilder<HttpTransport, S>
pub fn thread_builder<S>( &self, id: impl Into<ThreadId>, ) -> ThreadBuilder<HttpTransport, S>
Configure initial history, state, tools, diagnostics and verification.
Sourcepub fn restore_thread(
&self,
snapshot: ThreadSnapshot,
) -> Result<Thread<HttpTransport>>
pub fn restore_thread( &self, snapshot: ThreadSnapshot, ) -> Result<Thread<HttpTransport>>
Restore a saved local JSON conversation with this endpoint’s transport.
Sourcepub fn restore_thread_with_state<S: DeserializeOwned>(
&self,
snapshot: ThreadSnapshot,
) -> Result<Thread<HttpTransport, S>>
pub fn restore_thread_with_state<S: DeserializeOwned>( &self, snapshot: ThreadSnapshot, ) -> Result<Thread<HttpTransport, S>>
Restore and validate the current raw state against S.
Sourcepub fn run_events(&self, params: impl Into<RunAgentInput>) -> EventStream
pub fn run_events(&self, params: impl Into<RunAgentInput>) -> EventStream
Raw wire events, without normalization, validation or state application.
Sourcepub fn transport(&self) -> &HttpTransport
pub fn transport(&self) -> &HttpTransport
Underlying transport settings.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HttpAgent
impl !UnwindSafe for HttpAgent
impl Freeze for HttpAgent
impl Send for HttpAgent
impl Sync for HttpAgent
impl Unpin for HttpAgent
impl UnsafeUnpin for HttpAgent
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