Skip to content

Commit

Permalink
add debug trace on bedrock completion
Browse files Browse the repository at this point in the history
  • Loading branch information
ahau-square committed Feb 4, 2025
1 parent b9f244f commit ade2093
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/goose/src/providers/bedrock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use super::base::{Provider, ProviderMetadata, ProviderUsage, Usage};
use super::errors::ProviderError;
use crate::message::Message;
use crate::model::ModelConfig;
use crate::providers::utils::emit_debug_trace;

// Import the migrated helper functions from providers/formats/bedrock.rs
use super::formats::bedrock::{
Expand Down Expand Up @@ -146,8 +147,16 @@ impl Provider for BedrockProvider {
.unwrap_or_default();

let message = from_bedrock_message(&message)?;
let provider_usage = ProviderUsage::new(model_name.to_string(), usage);

// Add debug trace with input context
let debug_payload = serde_json::json!({
"system": system,
"messages": messages,
"tools": tools
});
emit_debug_trace(&self.model, &debug_payload, &serde_json::to_value(&message).unwrap_or_default(), &usage);

let provider_usage = ProviderUsage::new(model_name.to_string(), usage);
Ok((message, provider_usage))
}
}

0 comments on commit ade2093

Please sign in to comment.