diff --git a/server-rs/crates/platform-llm/src/lib.rs b/server-rs/crates/platform-llm/src/lib.rs index 3d705a99a..c1e471020 100644 --- a/server-rs/crates/platform-llm/src/lib.rs +++ b/server-rs/crates/platform-llm/src/lib.rs @@ -683,10 +683,7 @@ impl StreamAccumulation { .iter() .map(|pending| { let id = pending.id.clone().ok_or_else(|| { - LlmError::Deserialize(format!( - "LLM 流式工具调用缺少 id:slot={}", - pending.slot - )) + LlmError::Deserialize(format!("LLM 流式工具调用缺少 id:slot={}", pending.slot)) })?; let name = pending.name.clone().ok_or_else(|| { LlmError::Deserialize(format!( @@ -1966,11 +1963,9 @@ fn build_anthropic_messages_request_body( system: (!system.is_empty()).then_some(system), messages, tools, - tool_choice: request - .tool_choice - .map(|choice| AnthropicToolChoice { - choice_type: choice.as_anthropic_type(), - }), + tool_choice: request.tool_choice.map(|choice| AnthropicToolChoice { + choice_type: choice.as_anthropic_type(), + }), } } diff --git a/server-rs/crates/platform-llm/tests/live_stream_tool_calls.rs b/server-rs/crates/platform-llm/tests/live_stream_tool_calls.rs index 2f9c2a847..8307815e8 100644 --- a/server-rs/crates/platform-llm/tests/live_stream_tool_calls.rs +++ b/server-rs/crates/platform-llm/tests/live_stream_tool_calls.rs @@ -21,7 +21,9 @@ use platform_llm::{ }; fn env_var(name: &str) -> Option { - std::env::var(name).ok().filter(|value| !value.trim().is_empty()) + std::env::var(name) + .ok() + .filter(|value| !value.trim().is_empty()) } fn parse_api_kind(value: &str) -> LlmApiKind { @@ -86,7 +88,10 @@ async fn live_stream_run_returns_native_tool_calls() { response.finish_reason, response.text ); for call in &response.tool_calls { - println!("tool_call id={} name={} args={}", call.id, call.name, call.arguments); + println!( + "tool_call id={} name={} args={}", + call.id, call.name, call.arguments + ); } assert!(