Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added vector_search_local#1387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SilasMarvin merged 1 commit intomasterfromsilas-vector-search-local
Mar 23, 2024
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletionpgml-sdks/pgml/src/collection.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -935,7 +935,6 @@ impl Collection {
/// Ok(())
/// }
#[instrument(skip(self))]
#[allow(clippy::type_complexity)]
pub async fn vector_search(
&mut self,
query: Json,
Expand DownExpand Up@@ -995,6 +994,32 @@ impl Collection {
}
}

/// Same as vector_search but assumes embeddings are done locally
#[instrument(skip(self))]
pub async fn vector_search_local(
&self,
query: Json,
pipeline: &Pipeline,
) -> anyhow::Result<Vec<Json>> {
let pool = get_or_initialize_pool(&self.database_url).await?;
let (built_query, values) =
build_vector_search_query(query.clone(), self, pipeline).await?;
let results: Vec<(Json, String, f64)> = sqlx::query_as_with(&built_query, values)
.fetch_all(&pool)
.await?;
Ok(results
.into_iter()
.map(|v| {
serde_json::json!({
"document": v.0,
"chunk": v.1,
"score": v.2
})
.into()
})
.collect())
}

/// Archives a [Collection]
/// This will free up the name to be reused. It does not delete it.
///
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp