Skip to content

Instantly share code, notes, and snippets.

@zilto
Created September 8, 2023 13:39
Show Gist options
  • Save zilto/6acc2f4337e6b419d9a5b18447de6da1 to your computer and use it in GitHub Desktop.
Save zilto/6acc2f4337e6b419d9a5b18447de6da1 to your computer and use it in GitHub Desktop.
response = (
weaviate_client.query.get(
"Chunk", # Class
[ # Properties to retrieve
"chunk_index",
"content",
"summary",
"fromDocument {... on Document {_additional{id}}}", # Property of linked object
],
)
.with_hybrid( # hybrid search parameters
query=rag_query, # user text query
properties=["content"], # properties of `Chunk` to search on (specified above)
vector=query_embedding, # user query embedding/vector
alpha=hybrid_search_alpha, # hybrid search parameter
)
.with_additional(["score"]) # compute relevance score
.with_limit(retrieve_top_k) # return top k objects
.do()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment