fix(goose): propagate session_id across providers and MCP (#6584)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -4,6 +4,7 @@ use goose::conversation::message::Message;
|
||||
use goose::providers::databricks::DATABRICKS_DEFAULT_MODEL;
|
||||
use goose::providers::{base::Usage, create_with_named_model};
|
||||
use tokio_stream::StreamExt;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
@@ -19,8 +20,9 @@ async fn main() -> Result<()> {
|
||||
let message = Message::user().with_text("Tell me a short joke about programming.");
|
||||
|
||||
// Get a response
|
||||
let session_id = Uuid::new_v4().to_string();
|
||||
let mut stream = provider
|
||||
.stream("You are a helpful assistant.", &[message], &[])
|
||||
.stream(&session_id, "You are a helpful assistant.", &[message], &[])
|
||||
.await?;
|
||||
|
||||
println!("\nResponse from AI:");
|
||||
|
||||
@@ -10,6 +10,7 @@ use rmcp::model::{CallToolRequestParam, Content, Tool};
|
||||
use rmcp::object;
|
||||
use std::fs;
|
||||
use std::sync::Arc;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
@@ -61,8 +62,10 @@ async fn main() -> Result<()> {
|
||||
},
|
||||
}
|
||||
});
|
||||
let session_id = Uuid::new_v4().to_string();
|
||||
let (response, usage) = provider
|
||||
.complete(
|
||||
&session_id,
|
||||
"You are a helpful assistant. Please describe any text you see in the image.",
|
||||
&messages,
|
||||
&[Tool::new("view_image", "View an image", input_schema)],
|
||||
|
||||
Reference in New Issue
Block a user