use serde_json::json;
use veerdiff::model::{Step, StepKind, Trace};
use veerdiff::report::{RenderOptions, ReportFormat, render};
use veerdiff::{Config, diff_normalized};
fn main() {
let before = Trace::from_steps(vec![
Step::new(StepKind::Message)
.with_role("user")
.with_content("Refund order 12345"),
Step::new(StepKind::ToolCall)
.with_name("lookup_order")
.with_args(json!({ "order_id": "12345" })),
Step::new(StepKind::ToolCall)
.with_name("issue_refund")
.with_args(json!({ "order_id": "12345", "amount": 49.99 })),
]);
let after = Trace::from_steps(vec![
Step::new(StepKind::Message)
.with_role("user")
.with_content("Refund order 12345"),
Step::new(StepKind::ToolCall)
.with_name("lookup_order")
.with_args(json!({ "order_id": "12345" })),
Step::new(StepKind::ToolCall)
.with_name("issue_refund")
.with_args(json!({ "order_id": "12345", "amount": 59.99 })),
]);
let cfg = Config::default();
let (d, na, nb) = diff_normalized(before, after, &cfg);
println!("identical? {}", d.is_identical());
println!("similarity: {:.3}", d.similarity);
println!();
print!(
"{}",
render(
&d,
&na,
&nb,
ReportFormat::Human,
RenderOptions {
color: false,
verbose: true,
context: 2,
},
)
);
}