# namedVectors with custom embedder?

**URL:** <https://forum.weaviate.io/t/namedvectors-with-custom-embedder/3101>\
**Category:** Support\
**Tags:** python\
**Created:** [July 19, 2024, 8:22am UTC](https://forum.weaviate.io/t/namedvectors-with-custom-embedder/3101 "2024-07-19T08:22:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![noban](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@noban](https://forum.weaviate.io/u/noban)\
**Post date:** [July 19, 2024, 8:22am UTC](https://forum.weaviate.io/t/namedvectors-with-custom-embedder/3101/1 "2024-07-19T08:22:36Z")

</div>

### Description

I literally can’t find documentation on how to use (create and perform vector search) namedVectors (like 2 vectors per collection) using my custom vectors. Can anyone point me to the sample script showing how to do that, preferably using V4 syntax?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [July 31, 2024, 9:02pm UTC](https://forum.weaviate.io/t/namedvectors-with-custom-embedder/3101/2 "2024-07-31T21:02:43Z")

</div>

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):

> [@Authorization header is correct, but the token seems invalid](https://forum.weaviate.io/t/authorization-header-is-correct-but-the-token-seems-invalid/3223/2):
>
> hi @Anna_Caroline_Symond !! Welcome to our community hugs This message comes directly from hugging face Api. It indicates that your Hugging Face api token is wrong, not Weaviate’s. Also, there are some other issues with this code, like not passing the vectors your encoded yourself. This will trigger Weaviate to vectorize your object using the Hugging Face. You also created a named vector that uses title property as source, but was using text as the property receiving the data. I also ch…

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:

```python
            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:

```python
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!
