pub struct RandAgentBuilder { /* private fields */ }Expand description
线程安全 RandAgent 的构建器
Implementations§
Source§impl RandAgentBuilder
impl RandAgentBuilder
Sourcepub fn max_failures(self, max_failures: u32) -> Self
pub fn max_failures(self, max_failures: u32) -> Self
设置连续失败的最大次数,超过后标记代理为无效
Sourcepub fn on_agent_invalid<F>(self, callback: F) -> Self
pub fn on_agent_invalid<F>(self, callback: F) -> Self
设置 agent 失效时的回调
Sourcepub fn add_agent(
self,
agent: BoxAgent<'static>,
id: i32,
provider_name: String,
model_name: String,
) -> Self
pub fn add_agent( self, agent: BoxAgent<'static>, id: i32, provider_name: String, model_name: String, ) -> Self
添加代理到构建器
§参数
- agent: 代理实例(需要是 ’static 生命周期)
- provider_name: 提供方名称(如 openai、bigmodel 等)
- model_name: 模型名称(如 gpt-3.5、glm-4-flash 等)
Sourcepub fn add_builder(
self,
builder: Agent<CompletionModelHandle<'static>>,
id: i32,
provider_name: &str,
model_name: &str,
) -> Self
pub fn add_builder( self, builder: Agent<CompletionModelHandle<'static>>, id: i32, provider_name: &str, model_name: &str, ) -> Self
从 AgentBuilder 添加代理
§参数
- builder: AgentBuilder 实例(需要是 ’static 生命周期)
- provider_name: 提供方名称(如 openai、bigmodel 等)
- model_name: 模型名称(如 gpt-3.5、glm-4-flash 等)
Source§impl RandAgentBuilder
impl RandAgentBuilder
Sourcepub fn simple_builder(
self,
agent_configs: Vec<AgentConfig>,
global_system_prompt: String,
) -> Self
pub fn simple_builder( self, agent_configs: Vec<AgentConfig>, global_system_prompt: String, ) -> Self
简单构建器
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RandAgentBuilder
impl !RefUnwindSafe for RandAgentBuilder
impl Send for RandAgentBuilder
impl Sync for RandAgentBuilder
impl Unpin for RandAgentBuilder
impl !UnwindSafe for RandAgentBuilder
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