#community-help

Understanding Vector Naming in Typesense

TLDR Koushik was confused by inconsistent vector naming in Typesense documents. Jason clarified that the vector can be named anything, as long as it has a 'num_dim' property.

Powered by Struct AI
7
2mo
Solved
Join the chat
Aug 03, 2023 (2 months ago)
Koushik
Photo of md5-237fc2ec43c199f75556faf6aa5d6a0b
Koushik
03:23 PM
Hi, while creation a vector collection I used below JSON body (as per https://typesense.org/docs/0.24.0/api/vector-search.html#nearest-neighbor-vector-search),
{
"name": "catalogue_items_vectors",
"fields": [
{"name": ".*", "type": "auto"},
{"name": "vec", "type": "float[]", "num_dim": 768}
]
}
now while going through with sample codes https://github.com/typesense/typesense-instantsearch-semantic-search-demo/tree/master
I can see typesense-instantsearch-semantic-search-demo/scripts/vector-generation/main.py
creating vector field like
product['vectors'] = sentence_embeddings[0].tolist()

I am little confuse which is typesense internally points ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:37 PM
> I am little confuse which is typesense internally points ?
Not sure I understand the question. Could you elaborate?
Aug 04, 2023 (2 months ago)
Koushik
Photo of md5-237fc2ec43c199f75556faf6aa5d6a0b
Koushik
08:44 AM
The first link shows to create a vector collection and named vector key as "vec",
But the second link "main.py" inserting vector field named as "vector".
08:45
Koushik
08:45 AM
I believe typesense internally points to a key to find vector of that document. I am confused because two links creating vector with different string.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:56 PM
The vector can be named anything, as long as it has a num_dim property in the field definition. In the docs we’ve used the name vec as an example, and in the example we’ve used the word vector as the field name. You can rename it to any string
03:57
Jason
03:57 PM
For eg, in this demo I just put together yesterday, I’ve named the field embedding
Aug 06, 2023 (2 months ago)
Koushik
Photo of md5-237fc2ec43c199f75556faf6aa5d6a0b
Koushik
07:53 AM
Ohh great. got it. Thanks Jason Bosco.