From 7e938b2dd255064b2eaa5b21b89b640b80fc7a66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:58:28 +0000 Subject: [PATCH 1/2] chore(deps): update rig-core requirement from 0.15.1 to 0.28.0 Updates the requirements on [rig-core](https://github.com/0xPlaygrounds/rig) to permit the latest version. - [Release notes](https://github.com/0xPlaygrounds/rig/releases) - [Commits](https://github.com/0xPlaygrounds/rig/compare/rig-core-v0.15.1...rig-core-v0.28.0) --- updated-dependencies: - dependency-name: rig-core dependency-version: 0.28.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- examples/rig-integration/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rig-integration/Cargo.toml b/examples/rig-integration/Cargo.toml index 079ef0dc..4cc0ee92 100644 --- a/examples/rig-integration/Cargo.toml +++ b/examples/rig-integration/Cargo.toml @@ -13,7 +13,7 @@ readme = { workspace = true } publish = false [dependencies] -rig-core = "0.15.1" +rig-core = "0.28.0" tokio = { version = "1", features = ["full"] } rmcp = { workspace = true, features = [ "client", From 30401056aab7d126f1c89c148c29971dc77983e9 Mon Sep 17 00:00:00 2001 From: Alex Hancock Date: Tue, 13 Jan 2026 15:13:14 -0500 Subject: [PATCH 2/2] chore(deps): manual fixes required --- examples/rig-integration/src/chat.rs | 94 +++++++++++---------- examples/rig-integration/src/main.rs | 4 +- examples/rig-integration/src/mcp_adaptor.rs | 8 +- 3 files changed, 54 insertions(+), 52 deletions(-) diff --git a/examples/rig-integration/src/chat.rs b/examples/rig-integration/src/chat.rs index bc093689..bc50be1a 100644 --- a/examples/rig-integration/src/chat.rs +++ b/examples/rig-integration/src/chat.rs @@ -1,15 +1,16 @@ use futures::StreamExt; use rig::{ - agent::Agent, - completion::{AssistantContent, CompletionModel}, - message::Message, - streaming::StreamingChat, + agent::{Agent, MultiTurnStreamItem}, + completion::CompletionModel, + message::{Message, Text}, + streaming::{StreamedAssistantContent, StreamingChat}, }; use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter}; pub async fn cli_chatbot(chatbot: Agent) -> anyhow::Result<()> where - M: CompletionModel, + M: CompletionModel + 'static, + M::StreamingResponse: Send, { let mut chat_log = vec![]; @@ -28,49 +29,52 @@ where if input == ":q" { break; } - match chatbot.stream_chat(input, chat_log.clone()).await { - Ok(mut response) => { - tracing::info!(%input); - chat_log.push(Message::user(input)); - stream_output_agent_start(&mut output).await?; - let mut message_buf = String::new(); - while let Some(message) = response.next().await { - match message { - Ok(AssistantContent::Text(text)) => { - message_buf.push_str(&text.text); - output_agent(text.text, &mut output).await?; - } - Ok(AssistantContent::ToolCall(tool_call)) => { - let name = tool_call.function.name; - let arguments = tool_call.function.arguments; - chat_log.push(Message::assistant(format!( - "Calling tool: {name} with args: {arguments}" - ))); - let result = chatbot.tools.call(&name, arguments.to_string()).await; - match result { - Ok(tool_call_result) => { - stream_output_agent_finished(&mut output).await?; - stream_output_toolcall(&tool_call_result, &mut output).await?; - stream_output_agent_start(&mut output).await?; - chat_log.push(Message::user(tool_call_result)); - } - Err(e) => { - output_error(e, &mut output).await?; - } - } - } - Err(error) => { - output_error(error, &mut output).await?; - } - } + + tracing::info!(%input); + chat_log.push(Message::user(input)); + + let mut response = chatbot.stream_chat(input, chat_log.clone()).await; + stream_output_agent_start(&mut output).await?; + let mut message_buf = String::new(); + + while let Some(message) = response.next().await { + match message { + Ok(MultiTurnStreamItem::StreamAssistantItem(StreamedAssistantContent::Text( + Text { text }, + ))) => { + message_buf.push_str(&text); + output_agent(&text, &mut output).await?; + } + Ok(MultiTurnStreamItem::StreamAssistantItem( + StreamedAssistantContent::ToolCall(tool_call), + )) => { + let name = &tool_call.function.name; + let arguments = &tool_call.function.arguments; + stream_output_toolcall( + format!("Calling tool: {name} with args: {arguments}"), + &mut output, + ) + .await?; + } + Ok(MultiTurnStreamItem::StreamUserItem(user_content)) => { + // Tool results are streamed back as user items + stream_output_toolcall(format!("Tool result: {:?}", user_content), &mut output) + .await?; + } + Ok(MultiTurnStreamItem::FinalResponse(final_response)) => { + tracing::info!("Final response received: {:?}", final_response); + } + Ok(_) => { + // Handle other stream items (reasoning, deltas, etc.) + } + Err(error) => { + output_error(error, &mut output).await?; } - chat_log.push(Message::assistant(message_buf)); - stream_output_agent_finished(&mut output).await?; - } - Err(error) => { - output_error(error, &mut output).await?; } } + + chat_log.push(Message::assistant(message_buf)); + stream_output_agent_finished(&mut output).await?; } Ok(()) diff --git a/examples/rig-integration/src/main.rs b/examples/rig-integration/src/main.rs index c1a55b42..c9fe8119 100644 --- a/examples/rig-integration/src/main.rs +++ b/examples/rig-integration/src/main.rs @@ -29,14 +29,14 @@ async fn main() -> anyhow::Result<()> { let config = config::Config::retrieve("config.toml").await?; let deepseek_client = { if let Some(key) = config.deepseek_key { - deepseek::Client::new(&key) + deepseek::Client::new(&key)? } else { deepseek::Client::from_env() } }; let cohere_client = { if let Some(key) = config.cohere_key { - cohere::Client::new(&key) + cohere::Client::new(&key)? } else { cohere::Client::from_env() } diff --git a/examples/rig-integration/src/mcp_adaptor.rs b/examples/rig-integration/src/mcp_adaptor.rs index 286e58d5..f5397c63 100644 --- a/examples/rig-integration/src/mcp_adaptor.rs +++ b/examples/rig-integration/src/mcp_adaptor.rs @@ -20,8 +20,7 @@ impl RigTool for McpToolAdaptor { fn definition( &self, _prompt: String, - ) -> std::pin::Pin + Send + Sync + '_>> - { + ) -> std::pin::Pin + Send + '_>> { Box::pin(std::future::ready(rig::completion::ToolDefinition { name: self.name(), description: self @@ -37,9 +36,8 @@ impl RigTool for McpToolAdaptor { fn call( &self, args: String, - ) -> std::pin::Pin< - Box> + Send + Sync + '_>, - > { + ) -> std::pin::Pin> + Send + '_>> + { let server = self.server.clone(); Box::pin(async move { let call_mcp_tool_result = server