#![allow(clippy::print_stdout)]
use honcho_ai::Honcho;
use honcho_ai::types::dialectic::DialecticOptions;
#[tokio::main]
async fn main() -> honcho_ai::error::Result<()> {
let honcho = Honcho::from_params(
Honcho::builder()
.base_url("http://localhost:8000")
.workspace_id("multi-peer-demo")
.build(),
)?;
let alice = honcho.peer("alice", None, None).await?;
let bob = honcho.peer("bob", None, None).await?;
let carol = honcho.peer("carol", None, None).await?;
let session = honcho.session("group-chat", None, None, None).await?;
session.set_peers([&alice, &bob, &carol]).await?;
session
.add_messages(vec![alice.message("Hi everyone!").build()?])
.await?;
session
.add_messages(vec![bob.message("Hey Alice!").build()?])
.await?;
let response = alice
.chat_with_options(
&DialecticOptions::builder()
.query("Summarize the conversation")
.session_id("group-chat")
.build(),
)
.await?;
if let Some(text) = response {
println!("Alice's response: {text}");
}
let peers = session.peers().await?;
println!("Session has {} peer(s)", peers.len());
Ok(())
}