hi @noban !!
Welcome to our community!
Sorry! Missed this message.
Just discovered some messages that went under my radar
Hope you were able to solve this already
Luckly, I have just crafted some sample code that can help you on this topic (or for other in the future):
This example shows how to use a custom embed model (running locally), that is also offered by Hugging face.
Now, if you provide the named vectors, like in here:
batch.add_object(
properties={"title": line},
vector={
"title_vector": vector
}
)
Weaviate will not reach out to Hugging face to vectorize the object.
While performing searches, you can do the same. For example:
client.connect()
collection = client.collections.get("Test")
query_vector = model.encode(["pet animals"])
objects = collection.query.near_vector(
near_vector=query_vector[0],
return_metadata=wvc.query.MetadataQuery(distance=True),
include_vector=True,
target_vector="title_vector"
).objects
for object in objects:
print("#" * 10)
print(object.metadata.distance)
print(object.properties)
Let me know if this helps!
Thanks!