Hi all! I have a beginner question. I am trying to use Vectorize with my NextJS Cloudflare Pages web

Hi all! I have a beginner question. I am trying to use Vectorize with my NextJS Cloudflare Pages website. In this tutorial https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/ they say to use npx wrangler dev --remote to run locally and iterate. When I run that, I see:
✘ [ERROR] It looks like you've run a Workers-specific command in a Pages project.

For Pages, please run `wrangler pages dev` instead.
✘ [ERROR] It looks like you've run a Workers-specific command in a Pages project.

For Pages, please run `wrangler pages dev` instead.
But when I do that, I see:
❯ npx wrangler pages dev --remote


✘ [ERROR] Unknown argument: remote


wrangler pages dev [directory] [-- command..]

Develop your full-stack Pages application locally
❯ npx wrangler pages dev --remote


✘ [ERROR] Unknown argument: remote


wrangler pages dev [directory] [-- command..]

Develop your full-stack Pages application locally
I need to use --remote because of:
▲ [WARNING] Vectorize bindings are not currently supported in local mode. Please use --remote if you are working with them.
▲ [WARNING] Vectorize bindings are not currently supported in local mode. Please use --remote if you are working with them.
And without that, I see:
✘ [ERROR] Error in GET function: Error: VECTOR_INDEX binding is not available
✘ [ERROR] Error in GET function: Error: VECTOR_INDEX binding is not available
The AI binding and KV binding are working fine, no issues there, but I can't seem to get the Vectorize binding to show up at all. Maybe I'm making an obvious mistake -- I'm somewhat new to Cloudflare. Any help appreciated, thank you!
11 Replies
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Rahul gangotri
Rahul gangotri2mo ago
is this approach is good of create a unique NS for each user i have and keep their vectors in that namespace? and multiple indexes for set of users why is it onnly limited to 100 indexes per account, can we request to increase this? the product i am planning is going to store a lot of vectors we are already managing huge number of vectors using qdrant self hosted, but looking for cloudflare solution anyone?
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Rahul gangotri
Rahul gangotri2mo ago
🫡
Chinoman10
Chinoman102mo ago
If users don't need to access each other's vectors (if they should be silo'ed), then yes, creating a namespace per user is OK, although right-now there's a 1k namespaces limit per index. If they should be able to share them, then they should share a namespace and you use metadata filters instead for user segregation. So at the end of the day, you'll have to think what suits your use-case the best. Also, any ETA for this?
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
yanlinw
yanlinw2mo ago
For the metadata filtering, is it ok to do {"attribute":{"$ne", null} } ? another question is that any upsert support that only updates the metadata based on id ? Whats the recommended way to update metadata?
freddw
freddw2mo ago
Is best practice for supporting more complicated query semantics than just filtering to upsert vectors with a metadata field containing foreign keys to D1 records? Then implement your own pre/post filtering between the two? as an aside it seems like if the reasoning behind launching vectorize as a separate product from D1 is that either sqlite did not support vector search at the time of launch, or that it was not considered an ideal substrate for vector search, it could be nice to integrate vectorize within D1 under the hood (with restrictions to what is possible within vectorize databases) so that users could write simpler queries/have easier setup/less to manage. Because at the end of the day a lot of people (like me) will want to combine topK with joins and it'd be nice to not have to implement some of that myself, assuming I'm not missing something re: the current impl
yanlinw
yanlinw2mo ago
Given the limitations of the meta-filtering operation, I have to leverage a nested key structure as documented: { "pandas.nice": 42 } // looks for { "pandas": { "nice": 42 } } However, when I attempt to upsert metadata where the key contains a JSON object, as specified in the documentation, I encounter the following error: VECTOR_UPSERT_ERROR (code = 40019): invalid metadata for vector id=“jhbqpwft0qogbr1fs6re-0”; the metadata JSON object cannot contain JSON objects. I’m not sure what to do next. Does anyone have any suggestions? Thanks!
Talljoe
Talljoe2mo ago
When do you expect to update the Typescript API to use V2? I'm running into a problem where Wrangler doesn't support the --deprecated-v1 flag on certain calls. I just created the index today so I'm very happy to use V2 but don't want to roll my own client.
npm
cloudflare
The official TypeScript library for the Cloudflare API. Latest version: 3.5.0, last published: 3 months ago. Start using cloudflare in your project by running npm i cloudflare. There are 93 other projects in the npm registry using cloudflare.
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server