Find answers from the community

Updated 2 months ago

Weaviate

The issue is that there's only a set, specific way to query the vector db. I can't seem to construct and use my own search query.
Here's the search query I use for retrieval on Weaviate:
Plain Text
from weaviate.gql.get import HybridFusion
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("../../model-e5/", cache_folder="../../model_cache/")
model.cuda(device="cuda")

query = "sample query"
search_vector = model.encode(query)

response = (client.query.get(
        "CLASS_NAME",
        ["hasCategory { ... on REFERENCED_CLASS { uri } }"])
        .with_hybrid(query=query, alpha=0.8, vector=list(search_vector), fusion_type=HybridFusion.RELATIVE_SCORE)
        .with_additional("score")
        .with_autocut(1)
        .do()
    )
L
s
3 comments
Yea you can't really write your own query with weaviates api while using llama index

Looking at your query though, you could get close, but setting the embed_model in the service context to be the same e5 model, and then querying with hybrid turned on
Yeah but my query really relies on class references πŸ™ƒ so i wouldn't get everything i need.
Thanks for the help though, cheers.
Add a reply
Sign up and join the conversation on Discord