Own embedding value not vector search

I’m currently doing the following for my index
I want to be able to embed and use it externally, so I’m using the
Configure.Vectorizer.none()

indexing

    wv_client.collections.create(
        name=class_name,
        description="건강 식품 컬렉션",
        replication_config=Configure.replication(
            factor=1
        ),
        vectorizer_config=Configure.Vectorizer.none(),
        vector_index_config=Configure.VectorIndex.hnsw(
            distance_metric=VectorDistances.COSINE
        ),
        properties=[
            Property(name="product_no", description="상품 번호", data_type=DataType.NUMBER),
            Property(name="original_review", description="원본 리뷰", data_type=DataType.TEXT,
                     tokenization=Tokenization.WORD),
            Property(name="original_title", description="원본 상품명", data_type=DataType.TEXT,
                     tokenization=Tokenization.WORD),
            Property(name="original_detail", description="원본 OCR", data_type=DataType.TEXT,
                     tokenization=Tokenization.WORD),
            Property(name="title", description="상품명", data_type=DataType.TEXT),
            Property(name="review", description="리뷰", data_type=DataType.TEXT),
            Property(name="detail", description="OCR", data_type=DataType.TEXT)
        ]
    )

......

    with coll.batch.dynamic() as batch:
        for i, item in enumerate(dumps):
            product_no = item['product_no']
            product_name = item['prd_nm']
            review_text = item['review_text']
            ocr_text = item['ocr_text']

            title_embedding, review_embedding, detail_embedding = embeddings[i * 3:i * 3 + 3]
            title_embeddings.append(title_embedding)
            review_embeddings.append(review_embedding)
            detail_embeddings.append(detail_embedding)

            uuid = generate_uuid5(product_no)
            batch.add_object(
                properties={
                    "product_no": product_no,
                    "original_title": product_name,
                    "original_review": review_text,
                    "original_detail": ocr_text
                },
                vector={
                    "title": title_embedding,
                    "review": review_embedding,
                    "detail": detail_embedding
                },
                uuid=uuid
            )

The problem is that I get this error when searching, how do I fix it?

search

def search_weaviate(client, query_vector, class_name, feature, limit):
    col = client.collections.get(class_name)
    results = col.query.near_vector(near_vector=query_vector, limit=limit,
                                    return_properties=["product_no", "original_review"],
                                    include_vector="True",
                                    return_metadata=MetadataQuery(distance=True,
                                                                  creation_time=True),
                                    target_vector="detail")

    ....

    client.close()

Query call with protocol GRPC search failed with message extract target vectors: class Health_food does not have named vector detail configured. Available named vectors map[].

hi @HYK97

You never defined a named vector called detail in your collection.

So all vectors you add to this collection, will be added to the default named vector, called default

To fix this issue, you can either remove the target_vectors parameter, or set it to “default”

Let me know if this helps.

Thanks!

Doesn’t this create a named vector?

I thought I was creating 3 vectors like above and searching them using target_vector.

Because it saved the data properly, as shown in the photo below!

image

If you clear the target_vector parameter, it will not respond with any value when debugging, as shown in the photo below

Hi!

That would be a cool feature, hahaha.

I am not sure it creates, to be honest. AFAIK, the Auto Schema should only kick in for property.

I have written some code here to do what you want:

Let me know if this helps.

Thanks!

1 Like