From 7a089d846ec2b0f5447d253a52e884a5a6607881 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 21 Jun 2024 21:56:25 +0800 Subject: refactor: rename model.max_concurrent_chunks to model.max_batch_size (#626) --- src/client/common.rs | 2 +- src/client/model.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/client') diff --git a/src/client/common.rs b/src/client/common.rs index de2fa50..796c632 100644 --- a/src/client/common.rs +++ b/src/client/common.rs @@ -392,7 +392,7 @@ pub trait Client: Sync + Send { async fn embeddings(&self, data: EmbeddingsData) -> Result>> { let client = self.build_client()?; - self.model().guard_max_concurrent_chunks(&data)?; + self.model().guard_max_batch_size(&data)?; self.embeddings_inner(&client, data) .await .context("Failed to fetch embeddings") diff --git a/src/client/model.rs b/src/client/model.rs index 0584f82..4c69d78 100644 --- a/src/client/model.rs +++ b/src/client/model.rs @@ -175,8 +175,8 @@ impl Model { self.data.default_chunk_size.unwrap_or(1000) } - pub fn max_concurrent_chunks(&self) -> usize { - self.data.max_concurrent_chunks.unwrap_or(1) + pub fn max_batch_size(&self) -> usize { + self.data.max_batch_size.unwrap_or(1) } pub fn max_tokens_param(&self) -> Option { @@ -234,9 +234,9 @@ impl Model { Ok(()) } - pub fn guard_max_concurrent_chunks(&self, data: &EmbeddingsData) -> Result<()> { - if data.texts.len() > self.max_concurrent_chunks() { - bail!("Exceed max_concurrent_chunks limit"); + pub fn guard_max_batch_size(&self, data: &EmbeddingsData) -> Result<()> { + if data.texts.len() > self.max_batch_size() { + bail!("Exceed max_batch_size limit"); } Ok(()) } @@ -262,7 +262,7 @@ pub struct ModelData { // embedding-only properties pub default_chunk_size: Option, - pub max_concurrent_chunks: Option, + pub max_batch_size: Option, } impl ModelData { -- cgit v1.2.3