updated vector store settings to remove batch embeddings size
This commit is contained in:
parent
4b3bb2c661
commit
b68cd58a3b
3 changed files with 7 additions and 10 deletions
|
@ -293,9 +293,8 @@
|
||||||
},
|
},
|
||||||
// Difference settings for vector_store
|
// Difference settings for vector_store
|
||||||
"vector_store": {
|
"vector_store": {
|
||||||
"enable": false,
|
"enabled": false,
|
||||||
"reindexing_delay_seconds": 600,
|
"reindexing_delay_seconds": 600
|
||||||
"embedding_batch_size": 150
|
|
||||||
},
|
},
|
||||||
// Different settings for specific languages.
|
// Different settings for specific languages.
|
||||||
"languages": {
|
"languages": {
|
||||||
|
|
|
@ -37,6 +37,7 @@ use util::{
|
||||||
use workspace::{Workspace, WorkspaceCreated};
|
use workspace::{Workspace, WorkspaceCreated};
|
||||||
|
|
||||||
const VECTOR_STORE_VERSION: usize = 0;
|
const VECTOR_STORE_VERSION: usize = 0;
|
||||||
|
const EMBEDDINGS_BATCH_SIZE: usize = 150;
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
fs: Arc<dyn Fs>,
|
fs: Arc<dyn Fs>,
|
||||||
|
@ -70,7 +71,7 @@ pub fn init(
|
||||||
);
|
);
|
||||||
|
|
||||||
if *RELEASE_CHANNEL == ReleaseChannel::Stable
|
if *RELEASE_CHANNEL == ReleaseChannel::Stable
|
||||||
|| !settings::get::<VectorStoreSettings>(cx).enable
|
|| !settings::get::<VectorStoreSettings>(cx).enabled
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +354,6 @@ impl VectorStore {
|
||||||
});
|
});
|
||||||
|
|
||||||
// batch_tx/rx: Batch Files to Send for Embeddings
|
// batch_tx/rx: Batch Files to Send for Embeddings
|
||||||
let batch_size = settings::get::<VectorStoreSettings>(cx).embedding_batch_size;
|
|
||||||
let (batch_files_tx, batch_files_rx) = channel::unbounded::<EmbeddingJob>();
|
let (batch_files_tx, batch_files_rx) = channel::unbounded::<EmbeddingJob>();
|
||||||
let _batch_files_task = cx.background().spawn(async move {
|
let _batch_files_task = cx.background().spawn(async move {
|
||||||
let mut queue_len = 0;
|
let mut queue_len = 0;
|
||||||
|
@ -368,7 +368,7 @@ impl VectorStore {
|
||||||
} => {
|
} => {
|
||||||
queue_len += &document_spans.len();
|
queue_len += &document_spans.len();
|
||||||
embeddings_queue.push((worktree_id, parsed_file, document_spans));
|
embeddings_queue.push((worktree_id, parsed_file, document_spans));
|
||||||
queue_len >= batch_size
|
queue_len >= EMBEDDINGS_BATCH_SIZE
|
||||||
}
|
}
|
||||||
EmbeddingJob::Flush => true,
|
EmbeddingJob::Flush => true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,16 +5,14 @@ use settings::Setting;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct VectorStoreSettings {
|
pub struct VectorStoreSettings {
|
||||||
pub enable: bool,
|
pub enabled: bool,
|
||||||
pub reindexing_delay_seconds: usize,
|
pub reindexing_delay_seconds: usize,
|
||||||
pub embedding_batch_size: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||||
pub struct VectorStoreSettingsContent {
|
pub struct VectorStoreSettingsContent {
|
||||||
pub enable: Option<bool>,
|
pub enabled: Option<bool>,
|
||||||
pub reindexing_delay_seconds: Option<usize>,
|
pub reindexing_delay_seconds: Option<usize>,
|
||||||
pub embedding_batch_size: Option<usize>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Setting for VectorStoreSettings {
|
impl Setting for VectorStoreSettings {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue