BotClient

Trait BotClient 

pub trait BotClient: Send {
    // Required methods
    fn send(
        &mut self,
        bot_id: &BotId,
        messages: &[Message],
        tools: &[Tool],
    ) -> Pin<Box<dyn PlatformSendStream<Item = ClientResult<MessageContent>>>>;
    fn bots(
        &mut self,
    ) -> Pin<Box<dyn PlatformSendFuture<Output = ClientResult<Vec<Bot>>>>>;
    fn clone_box(&self) -> Box<dyn BotClient>;
}
Expand description

A standard interface to fetch bots information and send messages to them.

Keep this Clone and Sync as it may be required by the async context.

Required Methods§

fn send( &mut self, bot_id: &BotId, messages: &[Message], tools: &[Tool], ) -> Pin<Box<dyn PlatformSendStream<Item = ClientResult<MessageContent>>>>

Send a message to a bot with support for streamed response.

Each message yielded by the stream should be a snapshot of the full message as it is being built.

You are free to add, modify or remove content on-the-go.

fn bots( &mut self, ) -> Pin<Box<dyn PlatformSendFuture<Output = ClientResult<Vec<Bot>>>>>

Bots available under this client.

fn clone_box(&self) -> Box<dyn BotClient>

Make a boxed dynamic clone of this client to pass around.

Trait Implementations§

§

impl Clone for Box<dyn BotClient>

§

fn clone(&self) -> Box<dyn BotClient>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§