pub struct ThreadBuilder<'a, C, S, H>{ /* private fields */ }Expand description
Configures and launches one new thread on a LaunchingSystem. The
thread’s ID is generated at launch; the registered tools
and prompt are unioned onto the system-wide configuration for every
completion the thread runs.
Implementations§
Source§impl<C, S, H> ThreadBuilder<'_, C, S, H>
impl<C, S, H> ThreadBuilder<'_, C, S, H>
Sourcepub fn tool(self, tool: Box<dyn Tool<ChannelSender>>) -> Self
pub fn tool(self, tool: Box<dyn Tool<ChannelSender>>) -> Self
Give the thread an additional tool (on top of the system-wide tools).
Sourcepub fn tools(
self,
tools: impl IntoIterator<Item = Box<dyn Tool<ChannelSender>>>,
) -> Self
pub fn tools( self, tools: impl IntoIterator<Item = Box<dyn Tool<ChannelSender>>>, ) -> Self
Give the thread additional tools (on top of the system-wide tools).
Sourcepub fn extra_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn extra_system_prompt(self, prompt: impl Into<String>) -> Self
Append thread-specific text to the system prompt (after any system-wide extra prompt).
Sourcepub fn model(self, model: impl ModelSource + 'static) -> Self
pub fn model(self, model: impl ModelSource + 'static) -> Self
Give the thread its own ModelSource in place of the system-wide
one. Like the system-wide source, it resolves at the start of every
completion round, and threads this thread spawns inherit it.
Sourcepub async fn launch(self) -> ThreadHandle
pub async fn launch(self) -> ThreadHandle
Create the thread: generate its ID, register the launch
configuration, and attach. Returns the thread’s ThreadHandle
(its ID is ThreadHandle::thread_id).
The launch configuration lives for the lifetime of the process; a thread resumed after a restart runs with the system-wide configuration only.