pub struct AgentNode {
pub id: String,
pub name: String,
pub node_type: AgentNodeType,
/* private fields */
}Expand description
Agent 工作流节点
Fields§
§id: String节点 ID
name: String节点名称
node_type: AgentNodeType节点类型
Implementations§
Source§impl AgentNode
impl AgentNode
Sourcepub fn join_with<F, Fut>(
id: impl Into<String>,
wait_for: Vec<String>,
join_fn: F,
) -> AgentNodewhere
F: Fn(HashMap<String, AgentValue>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AgentValue> + Send + 'static,
pub fn join_with<F, Fut>(
id: impl Into<String>,
wait_for: Vec<String>,
join_fn: F,
) -> AgentNodewhere
F: Fn(HashMap<String, AgentValue>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AgentValue> + Send + 'static,
创建带自定义聚合函数的聚合节点
Sourcepub fn transform<F, Fut>(id: impl Into<String>, transform_fn: F) -> AgentNodewhere
F: Fn(AgentValue) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AgentValue> + Send + 'static,
pub fn transform<F, Fut>(id: impl Into<String>, transform_fn: F) -> AgentNodewhere
F: Fn(AgentValue) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AgentValue> + Send + 'static,
创建转换节点
Sourcepub fn with_prompt_template(self, template: impl Into<String>) -> AgentNode
pub fn with_prompt_template(self, template: impl Into<String>) -> AgentNode
设置提示词模板
模板中可以使用 {input} 占位符
Sourcepub fn with_session(self, session_id: impl Into<String>) -> AgentNode
pub fn with_session(self, session_id: impl Into<String>) -> AgentNode
设置会话 ID
Auto Trait Implementations§
impl Freeze for AgentNode
impl !RefUnwindSafe for AgentNode
impl Send for AgentNode
impl Sync for AgentNode
impl Unpin for AgentNode
impl UnsafeUnpin for AgentNode
impl !UnwindSafe for AgentNode
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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage