diff --git a/examples/c01-conv.rs b/examples/c01-conv.rs index e847648..2d13510 100644 --- a/examples/c01-conv.rs +++ b/examples/c01-conv.rs @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box> { let client = Client::default(); let mut chat_req = ChatRequest::default().with_system("Answer in one sentence"); - // Similar to put a first System Chat Message(s) (will be cummulative with sytem chat messages) + // Similar to putting a first System Chat Message(s) (will be cumulative with system chat messages) for &question in questions { chat_req = chat_req.append_message(ChatMessage::user(question)); diff --git a/src/adapter/adapter_kind.rs b/src/adapter/adapter_kind.rs index 28a6748..8c98e2f 100644 --- a/src/adapter/adapter_kind.rs +++ b/src/adapter/adapter_kind.rs @@ -10,8 +10,8 @@ pub enum AdapterKind { Cohere, Gemini, Groq, - // Note: Variants will probalby be suffixed - // AnthropicBerock, + // Note: Variants will probably be suffixed + // AnthropicBedrock, } /// Serialization impls diff --git a/src/adapter/adapter_types.rs b/src/adapter/adapter_types.rs index 3949af6..ddc5bdf 100644 --- a/src/adapter/adapter_types.rs +++ b/src/adapter/adapter_types.rs @@ -50,7 +50,7 @@ pub enum ServiceType { // region: --- WebRequestData -// NOTE: This cannot really move to `webc` bcause it has to be public with the adapter and `webc` is private for now. +// NOTE: This cannot really move to `webc` because it has to be public with the adapter and `webc` is private for now. pub struct WebRequestData { pub url: String, diff --git a/src/adapter/adapters/gemini/adapter_impl.rs b/src/adapter/adapters/gemini/adapter_impl.rs index 4b8e48e..cc0a70b 100644 --- a/src/adapter/adapters/gemini/adapter_impl.rs +++ b/src/adapter/adapters/gemini/adapter_impl.rs @@ -124,7 +124,7 @@ impl Adapter for GeminiAdapter { // region: --- Support -/// Suppot GeminiAdapter functions +/// Support GeminiAdapter functions impl GeminiAdapter { pub(super) fn body_to_gemini_chat_response(model_info: &ModelInfo, mut body: Value) -> Result { // if the body has a `error` property, then, it is assumed to be an error @@ -174,7 +174,7 @@ impl GeminiAdapter { let MessageContent::Text(content) = msg.content; match msg.role { - // for now, system go as "user" (later, we might have adapter_config.system_to_user_tmpl) + // for now, system go as "user" (later, we might have adapter_config.system_to_user_impl) ChatRole::System => systems.push(content), ChatRole::User => contents.push(json! ({"role": "user", "parts": [{"text": content}]})), ChatRole::Assistant => contents.push(json! ({"role": "model", "parts": [{"text": content}]})), @@ -197,7 +197,7 @@ impl GeminiAdapter { } } -// stuct Gemini +// struct Gemini pub(super) struct GeminiChatResponse { pub content: Option, diff --git a/src/adapter/adapters/openai/adapter_impl.rs b/src/adapter/adapters/openai/adapter_impl.rs index 55cd2f9..56b1853 100644 --- a/src/adapter/adapters/openai/adapter_impl.rs +++ b/src/adapter/adapters/openai/adapter_impl.rs @@ -152,7 +152,7 @@ impl OpenAIAdapter { /// - All messages get added with the corresponding roles (does not support tools for now) /// /// NOTE: here, the last `true` is for the ollama variant - /// It seems the Ollama compaitiblity layer does not work well with multiple System message. + /// It seems the Ollama compatibility layer does not work well with multiple System message. /// So, when `true`, it will concatenate the system message as a single on at the beginning fn into_openai_request_parts(model_info: ModelInfo, chat_req: ChatRequest) -> Result { let mut system_messages: Vec = Vec::new(); @@ -175,7 +175,7 @@ impl OpenAIAdapter { match msg.role { // for now, system and tool goes to system ChatRole::System => { - // see note in the funtion comment + // see note in the function comment if ollama_variant { system_messages.push(content); } else { diff --git a/src/adapter/adapters/openai/streamer.rs b/src/adapter/adapters/openai/streamer.rs index 5a860df..015419f 100644 --- a/src/adapter/adapters/openai/streamer.rs +++ b/src/adapter/adapters/openai/streamer.rs @@ -21,7 +21,7 @@ pub struct OpenAIStreamer { } impl OpenAIStreamer { - // TODO: Problen need the ChatOptions `.capture_content` `.capture_usage` + // TODO: Problem need the ChatOptions `.capture_content` `.capture_usage` pub fn new(inner: EventSource, model_info: ModelInfo, options_set: ChatOptionsSet<'_, '_>) -> Self { Self { inner, @@ -119,7 +119,7 @@ impl futures::Stream for OpenAIStreamer { && self.options.capture_usage { let usage = message_data.x_take("usage").map(OpenAIAdapter::into_usage).unwrap_or_default(); // premissive for now - self.captured_data.usage = Some(usage); // premissive for now + self.captured_data.usage = Some(usage); // permissive for now } } } diff --git a/src/adapter/inter_stream.rs b/src/adapter/inter_stream.rs index ef3a389..cc7ed29 100644 --- a/src/adapter/inter_stream.rs +++ b/src/adapter/inter_stream.rs @@ -1,6 +1,6 @@ //! Internal Stream Event Types which serve as an intermediary between the Provider event and the genai stream event. //! -//! This allows to eventually have flexibility if we want to capture event accross providers that does not need to +//! This allows to eventually have flexibility if we want to capture event across providers that does not need to //! be reflected in the public ChatStream event. //! //! NOTE: This might be removed at some point as it might not be needed, and going directly to the genai stream. diff --git a/src/chat/chat_options.rs b/src/chat/chat_options.rs index a65aa46..630a7f1 100644 --- a/src/chat/chat_options.rs +++ b/src/chat/chat_options.rs @@ -9,10 +9,10 @@ pub struct ChatOptions { /// Will be set for this request if Adapter/providers supports it. pub temperature: Option, - /// Will be set of this request if Adaptper/provider supports it. + /// Will be set of this request if Adapter/provider supports it. pub max_tokens: Option, - /// Will be set of this request if Adaptper/provider supports it. + /// Will be set of this request if Adapter/provider supports it. pub top_p: Option, /// (for steam only) Capture the meta usage when in stream mode diff --git a/src/chat/chat_res.rs b/src/chat/chat_res.rs index e48e559..1ea87c1 100644 --- a/src/chat/chat_res.rs +++ b/src/chat/chat_res.rs @@ -1,4 +1,4 @@ -//! This module contains all the types related to a Chat Reponse (except ChatStream which has it file). +//! This module contains all the types related to a Chat Response (except ChatStream which has it file). use crate::chat::{ChatStream, MessageContent}; @@ -13,13 +13,13 @@ pub struct ChatResponse { // Getters impl ChatResponse { /// Returns the eventual content as `&str` if it is of type `MessageContent::Text` - /// Ohterwise, return None + /// Otherwise, return None pub fn content_text_as_str(&self) -> Option<&str> { self.content.as_ref().and_then(MessageContent::text_as_str) } /// Consume the ChatResponse and returns the eventual String content of the `MessageContent::Text` - /// Ohterwise, return None + /// Otherwise, return None pub fn content_text_into_string(self) -> Option { self.content.and_then(MessageContent::text_into_string) } diff --git a/src/client/builder.rs b/src/client/builder.rs index 2577a49..93589b0 100644 --- a/src/client/builder.rs +++ b/src/client/builder.rs @@ -8,7 +8,7 @@ use std::sync::Arc; #[derive(Debug, Default)] pub struct ClientBuilder { - apapter_config_by_kind: Option>, + adapter_config_by_kind: Option>, web_client: Option, @@ -29,7 +29,7 @@ impl ClientBuilder { } pub fn insert_adapter_config(mut self, kind: AdapterKind, adapter_config: AdapterConfig) -> Self { - self.apapter_config_by_kind + self.adapter_config_by_kind .get_or_insert_with(HashMap::new) .insert(kind, adapter_config); self @@ -64,7 +64,7 @@ impl ClientBuilder { let inner = super::ClientInner { web_client: self.web_client.unwrap_or_default(), config: self.config.unwrap_or_default(), - apapter_config_by_kind: self.apapter_config_by_kind, + adapter_config_by_kind: self.adapter_config_by_kind, }; Client { inner: Arc::new(inner) } } diff --git a/src/client/client_types.rs b/src/client/client_types.rs index 97a7a75..bc0b2a4 100644 --- a/src/client/client_types.rs +++ b/src/client/client_types.rs @@ -10,7 +10,7 @@ pub struct Client { pub(super) inner: Arc, } -// region: --- Client Construstors +// region: --- Client C'o'n's't'r'u'c't'o'r's impl Default for Client { fn default() -> Self { @@ -24,7 +24,7 @@ impl Client { } } -// endregion: --- Client Construstors +// endregion: --- Client Constructors // region: --- Client Getters @@ -39,7 +39,7 @@ impl Client { /// Returns the eventual custom AdapterConfig that has been set for this client (in the builder phase) pub(crate) fn custom_adapter_config(&self, adapter_kind: AdapterKind) -> Option<&AdapterConfig> { - self.inner.apapter_config_by_kind.as_ref()?.get(&adapter_kind) + self.inner.adapter_config_by_kind.as_ref()?.get(&adapter_kind) } } @@ -50,7 +50,7 @@ impl Client { #[derive(Debug)] pub(super) struct ClientInner { #[allow(unused)] - pub(super) apapter_config_by_kind: Option>, + pub(super) adapter_config_by_kind: Option>, pub(super) web_client: WebClient, diff --git a/src/resolver/auth_resolver.rs b/src/resolver/auth_resolver.rs index ac851dc..90fafcc 100644 --- a/src/resolver/auth_resolver.rs +++ b/src/resolver/auth_resolver.rs @@ -4,7 +4,7 @@ //! - Contain a fixed auth value, //! - Contain an `AuthResolverFnSync` trait object or closure that will be called to return the AuthData. //! -//! Note: AuthData is typically a single value but can be Multi for future adapters (e.g., AWS Berock). +//! Note: AuthData is typically a single value but can be Multi for future adapters (e.g., AWS Bedrock). use crate::adapter::AdapterKind; use crate::resolver::{Error, Result}; diff --git a/src/webc/web_stream.rs b/src/webc/web_stream.rs index f42fdb2..7f48fe8 100644 --- a/src/webc/web_stream.rs +++ b/src/webc/web_stream.rs @@ -124,7 +124,7 @@ impl Stream for WebStream { this.partial_message = Some(candidate_message); } - // -- If we have a furst message, we nave to send it. + // -- If we have a first message, we have to send it. if let Some(first_message) = first_message.take() { return Poll::Ready(Some(Ok(first_message))); } else { @@ -170,7 +170,7 @@ struct BuffResponse { /// /// IMPORTANT: Right now, it assumes each buff_string will contain the full main json object /// for each array item (Which seems to be the case with Gemini) -/// This probaby need to be made more robust later +/// This probably need to be made more robust later fn new_with_pretty_json_array( buff_string: String, _partial_message: &mut Option, @@ -179,7 +179,7 @@ fn new_with_pretty_json_array( let mut messages: Vec = Vec::new(); - // -- Capther the array start/end and each eventual sub object (assuming only one sub objecct) + // -- Capture the array start/end and each eventual sub object (assuming only one sub object) let (array_start, rest_str) = match buff_str.strip_prefix('[') { Some(rest) => (Some("["), rest.trim()), None => (None, buff_str), @@ -240,10 +240,10 @@ fn process_buff_string_delimited( for part in parts { // if we already have a candidate, the candidate become the message - if let Some(canditate_message) = candidate_message.take() { - // if canditate is empty, we skip - if !canditate_message.is_empty() { - let message = canditate_message.to_string(); + if let Some(candidate_message) = candidate_message.take() { + // if candidate is empty, we skip + if !candidate_message.is_empty() { + let message = candidate_message.to_string(); if first_message.is_none() { first_message = Some(message); } else {