We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a9aa07 commit 36dd853Copy full SHA for 36dd853
src/indexer.rs
@@ -3,7 +3,7 @@ use crate::{
3
openai::{embeddings_for, EmbeddingError},
4
server::Operation,
5
vecmath::{self, Embedding},
6
- vectors::{LoadedVec, VectorStore},
+ vectors::{Domain, LoadedVec, VectorStore},
7
};
8
use hnsw::{Hnsw, Searcher};
9
use rand_pcg::Lcg128Xsl64;
@@ -89,7 +89,7 @@ enum Op {
89
}
90
91
pub async fn operations_to_point_operations(
92
- domain: &str,
+ domain: &Domain,
93
vector_store: &VectorStore,
94
structs: Vec<Result<Operation, std::io::Error>>,
95
key: &str,
@@ -114,7 +114,6 @@ pub async fn operations_to_point_operations(
114
} else {
115
embeddings_for(key, &strings).await?
116
117
- let domain = vector_store.get_domain(domain)?;
118
let loaded_vecs = vector_store.add_and_load_vecs(&domain, vecs.iter())?;
119
let mut new_ops: Vec<PointOperation> = zip(tuples, loaded_vecs)
120
.map(|((op, _, id), vec)| match op {
src/main.rs
@@ -200,6 +200,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
200
let dirpath = Path::new(&directory);
201
let mut hnsw: HnswIndex = Hnsw::new(OpenAI);
202
let store = VectorStore::new(dirpath, size);
203
+ let resolved_domain = store.get_domain(&domain)?;
204
205
let f = File::options().read(true).open(path)?;
206
@@ -216,7 +217,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
216
217
for structs in opstream {
218
let structs: Vec<_> = structs.collect();
219
let new_ops =
- operations_to_point_operations(&domain.clone(), &store, structs, &key).await?;
220
+ operations_to_point_operations(&resolved_domain, &store, structs, &key).await?;
221
hnsw = start_indexing_from_operations(hnsw, new_ops).unwrap();
222
223
let index_id = create_index_name(&domain, &commit);
src/server.rs
@@ -505,16 +505,13 @@ impl Service {
505
previous,
506
})
507
.await;
508
+ let domain = self.vector_store.get_domain(&domain)?;
509
self.set_task_status(task_id.to_string(), TaskStatus::Pending(0.3))
510
511
while let Some(structs) = opstream.next().await {
- let new_ops = operations_to_point_operations(
512
- &domain.clone(),
513
- &self.vector_store,
514
- structs,
515
- api_key,
516
- )
517
- .await?;
+ let new_ops =
+ operations_to_point_operations(&domain, &self.vector_store, structs, api_key)
+ .await?;
518
hnsw = start_indexing_from_operations(hnsw, new_ops)?;
519
520
self.set_task_status(task_id.to_string(), TaskStatus::Pending(0.8))
0 commit comments