pub struct ChatBuilder<CP, Output = Unstructured>where
CP: CompletionProvider,{ /* private fields */ }Implementations§
Source§impl<CP> ChatBuilder<CP>where
CP: CompletionProvider,
impl<CP> ChatBuilder<CP>where
CP: CompletionProvider,
pub fn new() -> ChatBuilder<CP>
pub fn with_structured_output<T>(self) -> ChatBuilder<CP, Structured<T>>where
T: JsonSchema + DeserializeOwned,
pub fn with_embeddings(self) -> ChatBuilder<CP, Embedded>
Source§impl<CP, Output> ChatBuilder<CP, Output>where
CP: CompletionProvider,
impl<CP, Output> ChatBuilder<CP, Output>where
CP: CompletionProvider,
pub fn with_max_steps(self, max_steps: u16) -> ChatBuilder<CP, Output>
pub fn with_max_retries(self, max_retries: u16) -> ChatBuilder<CP, Output>
Sourcepub fn with_tools(self, tools: ToolCollection) -> ChatBuilder<CP, Output>
pub fn with_tools(self, tools: ToolCollection) -> ChatBuilder<CP, Output>
Convenience: wrap a plain ToolCollection<NoMeta> with an
always-execute strategy. Equivalent to
.with_scoped_tools(ScopedCollection::auto_execute(tools)).
Sourcepub fn with_scoped_tools<M, F>(
self,
scoped: ScopedCollection<M, F>,
) -> ChatBuilder<CP, Output>
pub fn with_scoped_tools<M, F>( self, scoped: ScopedCollection<M, F>, ) -> ChatBuilder<CP, Output>
Attach a typed tool collection with a user-defined strategy.
Multiple calls are additive — the resulting Chat routes each
tool call to the collection that owns its name.
pub fn with_retry_strategy( self, retry_strategy: Box<dyn Fn(&mut Messages, Option<&Metadata>, CallbackRetryContext) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>, ) -> ChatBuilder<CP, Output>
Sourcepub fn with_before_strategy(
self,
before_strategy: Box<dyn Fn(&mut Messages, Option<&Metadata>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) -> ChatBuilder<CP, Output>
pub fn with_before_strategy( self, before_strategy: Box<dyn Fn(&mut Messages, Option<&Metadata>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>, ) -> ChatBuilder<CP, Output>
Run a strategy before the loop starts. It receives the outgoing
Messages (which it may mutate synchronously) and the most recent
Metadata, and returns a future for any async side effects.
Sourcepub fn with_after_strategy(
self,
after_strategy: Box<dyn Fn(&mut Messages, Option<&Metadata>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) -> ChatBuilder<CP, Output>
pub fn with_after_strategy( self, after_strategy: Box<dyn Fn(&mut Messages, Option<&Metadata>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>, ) -> ChatBuilder<CP, Output>
Run a strategy after the loop completes successfully. It receives the
final Messages and the run’s Metadata.
pub fn with_model(self, model: CP) -> ChatBuilder<CP, Output>
pub fn with_options(self, options: ChatOptions) -> ChatBuilder<CP, Output>
pub fn build(self) -> Chat<CP, Output>
Trait Implementations§
Source§impl<CP> Default for ChatBuilder<CP>where
CP: CompletionProvider,
impl<CP> Default for ChatBuilder<CP>where
CP: CompletionProvider,
Source§fn default() -> ChatBuilder<CP>
fn default() -> ChatBuilder<CP>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<CP, Output = Unstructured> !RefUnwindSafe for ChatBuilder<CP, Output>
impl<CP, Output = Unstructured> !UnwindSafe for ChatBuilder<CP, Output>
impl<CP, Output> Freeze for ChatBuilder<CP, Output>where
CP: Freeze,
impl<CP, Output> Send for ChatBuilder<CP, Output>where
Output: Send,
impl<CP, Output> Sync for ChatBuilder<CP, Output>where
Output: Sync,
impl<CP, Output> Unpin for ChatBuilder<CP, Output>
impl<CP, Output> UnsafeUnpin for ChatBuilder<CP, Output>where
CP: UnsafeUnpin,
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