Skip to content

Commit c4586c6

Browse files
Brandon Kvardaclaude
andcommitted
style: fix formatting and clippy type_complexity warning
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Brandon Kvarda <brandon.kvarda@databricks.com>
1 parent 9036f2a commit c4586c6

3 files changed

Lines changed: 31 additions & 13 deletions

File tree

crates/goose/src/providers/formats/databricks.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,10 +1233,7 @@ mod tests {
12331233
fn test_format_messages_with_multiple_metadata_fields() -> anyhow::Result<()> {
12341234
// Test that multiple metadata fields are all preserved
12351235
let mut metadata = serde_json::Map::new();
1236-
metadata.insert(
1237-
"thoughtSignature".to_string(),
1238-
json!("sig_top_level"),
1239-
);
1236+
metadata.insert("thoughtSignature".to_string(), json!("sig_top_level"));
12401237
metadata.insert(
12411238
"extra_content".to_string(),
12421239
json!({
@@ -1245,10 +1242,7 @@ mod tests {
12451242
}
12461243
}),
12471244
);
1248-
metadata.insert(
1249-
"custom_field".to_string(),
1250-
json!("custom_value"),
1251-
);
1245+
metadata.insert("custom_field".to_string(), json!("custom_value"));
12521246

12531247
let message = Message::assistant().with_tool_request_with_metadata(
12541248
"tool1",

crates/goose/src/providers/formats/openai.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@ use rmcp::model::{
1616
use serde::{Deserialize, Serialize};
1717
use serde_json::{json, Value};
1818
use std::borrow::Cow;
19+
use std::collections::HashMap;
1920
use std::ops::Deref;
2021

22+
/// Type alias for tool call data: (id, name, arguments, extra_fields)
23+
type ToolCallData = HashMap<
24+
i32,
25+
(
26+
String,
27+
String,
28+
String,
29+
Option<serde_json::Map<String, Value>>,
30+
),
31+
>;
32+
2133
#[derive(Serialize, Deserialize, Debug)]
2234
struct DeltaToolCallFunction {
2335
name: Option<String>,
@@ -510,7 +522,7 @@ where
510522
yield (None, usage)
511523
} else if chunk.choices[0].delta.tool_calls.as_ref().is_some_and(|tc| !tc.is_empty()) {
512524
// (id, name, arguments, extra_fields) - extra_fields captures all non-standard fields
513-
let mut tool_call_data: std::collections::HashMap<i32, (String, String, String, Option<serde_json::Map<String, Value>>)> = std::collections::HashMap::new();
525+
let mut tool_call_data: ToolCallData = HashMap::new();
514526

515527
if let Some(tool_calls) = &chunk.choices[0].delta.tool_calls {
516528
for tool_call in tool_calls {

crates/goose/src/providers/openai.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,14 @@ impl Provider for OpenAiProvider {
284284
log.write(&json_response, Some(&usage))?;
285285
Ok((message, ProviderUsage::new(model, usage)))
286286
} else {
287-
let payload =
288-
create_request(model_config, system, messages, tools, &ImageFormat::OpenAi, false)?;
287+
let payload = create_request(
288+
model_config,
289+
system,
290+
messages,
291+
tools,
292+
&ImageFormat::OpenAi,
293+
false,
294+
)?;
289295

290296
let mut log = RequestLog::start(&self.model, &payload)?;
291297
let json_response = self
@@ -402,8 +408,14 @@ impl Provider for OpenAiProvider {
402408
}
403409
}))
404410
} else {
405-
let payload =
406-
create_request(&self.model, system, messages, tools, &ImageFormat::OpenAi, true)?;
411+
let payload = create_request(
412+
&self.model,
413+
system,
414+
messages,
415+
tools,
416+
&ImageFormat::OpenAi,
417+
true,
418+
)?;
407419
let mut log = RequestLog::start(&self.model, &payload)?;
408420

409421
let response = self

0 commit comments

Comments
 (0)