Hey guys, Have one doubt, I was going through <htt...
# community-help
a
Hey guys, Have one doubt, I was going through https://typesense.org/docs/29.0/api/image-search.html#create-a-collection. I have an existing collection - I want to add image field and generate imageEmbedding using that field. I was thinking to update the existing collection schema and then reindex the documents to populate image. I don't want to generate the embeddings if it's already generated 1. If i update the existing document and image field is not changed(I'm assuming my base64 will not get changed for same image) Will it generate the embedding again? 2. Second option is that I don't send the image field on update - I want to avoid this because this involves more work😅 Thanks for the help in advance
Also I'm getting
Copy code
{
  "message": "`model_config` should be an object containing `model_name` and `api_key` as string values."
}
curl -
Copy code
curl --location --request PATCH '<https://xyz/collections/variantV3>' \
--header 'X-TYPESENSE-API-KEY: xyz' \
--header 'Content-Type: application/json' \
--data '{
    "fields": [
        {
            "name": "featuredImageBase64",
            "type": "image",
            "store": false,
            "optional": true
        },
        {
            "name": "imageEmbedding",
            "type": "float[]",
            "embed": {
                "from": [
                    "featuredImageBase64"
                ],
                "model_config": {
                    "model_name": "ts/clip-vit-b-p32"
                }
            },
            "optional": true
        }
    ]
}'
I'm using ts model. Why is it not going through?
Typesense version - v30.0.rc3
f
Did the
featuredImageBase64
field exist before the update?
a
No no i got the issue. imageEmbedding used to exist already. I forgot to drop it.
f
Did it work correctly now? 😄
a
Both are new fields. Just one thing, i want to create image embedding with this new field. I was thinking to first update the schema basically add featuredImageBase64 and imageEmbedding. featuredImageBase64 would be null at start that's why kept it optional. Will it still generate the embedding or ignore as it's null. I want to populate featuredImageBase64 later
f
You mentioned image embedding already existing beforehand. Could you share a set of commands similar to this gist so we can debug this?
a
so imageEmbedding used to exist before. It was embedded from wrong fields. I dropped the field now. I ran schema update with the following req body - { "fields": [ { "name": "featuredImageBase64", "type": "image", "store": false, "optional": true }, { "name": "imageEmbedding", "type": "float[]", "embed": { "from": [ "featuredImageBase64" ], "model_config": { "model_name": "ts/clip-vit-b-p32" } }, "optional": true } ] }
f
Did it now work though? Or was the same error returned by the server?
a
It's through. It's in progress. One thing i can't understand is featuredImageBase64 is a new field and would be null but i can see imageEmbeddings are getting generated even though featuredImageBase64 is null.
I was thinking to reindex the documents with featuredImageBase64 later.
f
When you re-index or add new documents, new embeddings will be generated. Could you share some existing embeddings?
a
Untitled
f
This isn't something I can reproduce. The old documents don't include any embeddings on my test. Only new ones get their embeddings generated by the model.
a
got it. Just to confirm again, if i reindex and my embedded field is updated, Embedding would be generated again, right?
f
Yes, but you have to pass in an image to the old document
a
got it. Thanks much for quick help
🙌 1
Untitled
Hey @Fanis Tharropoulos, I have indexed some of the documents with the image field. I'm trying to test similar search but getting this error -
Copy code
{
  "results": [
    {
      "code": 400,
      "error": "Malformed vector query string: could not embed image."
    }
  ]
}
f
Is this coming when indexing a document? We would definitely need a reproducible example, as this wasn't the case when I was testing this locally.
a
No, this is coming while searching. Have shared the curl as well
f
That encoded string can't be decoded by the model: 2025-08-29 140220.217259884 [Eonnxruntime, sequential_executor.cc:494 ExecuteKernel] Non-zero status code returned while running DecodeImage node. Name:'pre_process_0' Status Message: [DecodeImage] Invalid input. Failed to decode image.
a
got it. I will recheck this. Thanks!