Find answers from the community

s
sidbin
Offline, last seen 3 months ago
Joined September 25, 2024
s
sidbin
·

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()
    )
3 comments
s
L