pub struct HttpPlugin { /* private fields */ }Expand description
示例HTTP请求插件
Implementations§
Trait Implementations§
Source§impl Plugin for HttpPlugin
impl Plugin for HttpPlugin
Source§fn description(&self) -> &str
fn description(&self) -> &str
获取插件描述
Source§fn metadata(&self) -> PluginMetadata
fn metadata(&self) -> PluginMetadata
获取插件元数据
Source§fn pre_context<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pre_context<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
在上下文组装前执行
可以动态修改上下文
Source§fn pre_request<'life0, 'life1, 'async_trait>(
&'life0 self,
input: AgentInput,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<AgentInput, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn pre_request<'life0, 'life1, 'async_trait>(
&'life0 self,
input: AgentInput,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<AgentInput, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
在请求处理前执行
可以修改输入内容
Source§fn post_response<'life0, 'life1, 'async_trait>(
&'life0 self,
output: AgentOutput,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn post_response<'life0, 'life1, 'async_trait>(
&'life0 self,
output: AgentOutput,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
在LLM响应后执行
可以修改LLM返回的结果
Source§fn post_process<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn post_process<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
在整个流程完成后执行
可以进行清理或后续处理
Auto Trait Implementations§
impl Freeze for HttpPlugin
impl RefUnwindSafe for HttpPlugin
impl Send for HttpPlugin
impl Sync for HttpPlugin
impl Unpin for HttpPlugin
impl UnsafeUnpin for HttpPlugin
impl UnwindSafe for HttpPlugin
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more