From 90fac766259872f30a4cfe8346dbab409de779b3 Mon Sep 17 00:00:00 2001 From: Jeremy Chone Date: Sat, 7 Dec 2024 10:31:31 -0800 Subject: [PATCH] . minor clippy_clean --- src/adapter/adapters/anthropic/adapter_impl.rs | 2 +- src/chat/chat_options.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/adapter/adapters/anthropic/adapter_impl.rs b/src/adapter/adapters/anthropic/adapter_impl.rs index 6f7a5cd..7477826 100644 --- a/src/adapter/adapters/anthropic/adapter_impl.rs +++ b/src/adapter/adapters/anthropic/adapter_impl.rs @@ -94,7 +94,7 @@ impl Adapter for AnthropicAdapter { payload.x_insert("temperature", temperature)?; } - if options_set.stop_sequences().len() > 0 { + if !options_set.stop_sequences().is_empty() { payload.x_insert("stop_sequences", options_set.stop_sequences())?; } diff --git a/src/chat/chat_options.rs b/src/chat/chat_options.rs index 8839572..6c361fa 100644 --- a/src/chat/chat_options.rs +++ b/src/chat/chat_options.rs @@ -5,9 +5,9 @@ //! Note 1: In the future, we will probably allow setting the client //! Note 2: Extracting it from the `ChatRequest` object allows for better reusability of each component. -use std::ops::Deref; use crate::chat::chat_req_response_format::ChatResponseFormat; use serde::{Deserialize, Serialize}; +use std::ops::Deref; /// Chat Options that are taken into account for any `Client::exec...` calls. /// @@ -40,7 +40,7 @@ pub struct ChatOptions { pub response_format: Option, /// Specifies sequences used as end marker when generating text - pub stop_sequences: Vec + pub stop_sequences: Vec, } /// Chainable Setters @@ -173,7 +173,7 @@ impl ChatOptionsSet<'_, '_> { self.chat .map(|chat| chat.stop_sequences.deref()) .or_else(|| self.client.map(|client| client.stop_sequences.deref())) - .unwrap_or_else(|| &[]) + .unwrap_or(&[]) } }