Disclaimer: All code and information provided in this repository is made available on an "as-is" basis with the express understanding that Cloudflare has no obligation to monitor, control, maintain or otherwise update the materials. This demo is intended for demonstration purposes only and should not be used for production workloads. Your use of the demo is at your own discretion and risk. Cloudflare makes no claims or promises about the quality, accuracy, or reliability of the demo, its safety or security, or content generated by the demo (if any). Cloudflare is not liable to you for any loss or damage that might arise from your use of the demo.
This application consists of two main components:
- A Cloudflare Account
- Cloudflare Wrangler installed
- Click the "Deploy to Cloudflare" button above to deploy the
/api
directory to your Cloudflare account - On the configuration page:
- You can use default names or customize them for your application
- For Vectorize settings:
- Dimensions:
768
- Metric:
cosine
- Dimensions:
⚠️ Important: Names cannot contain underscores (_
)
- Save the URL of your deployed API for later use
Create an AI Gateway named are-you-ai-demo
in your Cloudflare account:
- Clone this repository to your local machine
- Create the database tables using the schema file, run this command in the root of the repository:
Replace
npx wrangler d1 execute <your-db-name> --remote --file=./api/db-schema.sql
<your-db-name>
with your D1 database name
Run these setup endpoints in order, it will look like nothing is happening but these setup scripts can take a few minutes to complete:
-
Setup Images:
- Visit:
<your-api-url>/setupImages
- Example:
https://are-you-ai-api-test.thomas-development.workers.dev/setupImages
- Wait until you see "Image Setup Complete"
- Visit:
-
Setup Vectorize:
- Visit:
<your-api-url>/setupVectorize
- Example:
https://are-you-ai-api-test.thomas-development.workers.dev/setupVectorize
- Wait until you see "Vectorize Setup Complete"
- Visit:
- Deploy using the "Deploy to Cloudflare" button with default settings
- After deployment:
- Go to the worker settings
- Edit environment variable:
- Name:
API_ENDPOINT
- Value: Your deployed API URL - no trailing
/
at the end - Example:
https://are-you-ai-api-test.thomas-development.workers.dev
- Name: