Skip to content

Instantly share code, notes, and snippets.

@veekaybee
Last active July 31, 2023 23:55
Show Gist options
  • Save veekaybee/fdd340a2d1362d33166b402529af3dec to your computer and use it in GitHub Desktop.
Save veekaybee/fdd340a2d1362d33166b402529af3dec to your computer and use it in GitHub Desktop.
q = (Query(f"*=>[KNN {top_k} @{self.vector_field} $vec_param AS vector_score]")
.sort_by("vector_score", asc=False)
.sort_by(f"{self.review_count_field}", asc=False)
.paging(0, top_k)
.return_fields(
"vector_score",
self.vector_field,
self.title_field,
self.author_field,
self.link_field,
self.review_count_field,
)
.dialect(2)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment