Overview
You will learn to:- Set up your Neosantara AI API client and Cloudflare API credentials.
- Create and manage a Vectorize index.
- Use Neosantara AI’s embedding model (
nusa-embedding-0001) to vectorize your documents. - Store these embeddings in Cloudflare Vectorize.
- Retrieve relevant documents from Vectorize based on a user query.
- Use Neosantara AI’s chat model (
nusantara-base) to generate a grounded answer using the retrieved context.
Prerequisites
- A Cloudflare account with API Token access (with permissions for Vectorize).
- Your Cloudflare Account ID.
- A Neosantara AI API Key.
Setup
First, install the necessary Python library:Configure your API Keys and Client
Step 1: Indexing Documents in Vectorize (Ingestion)
First, let’s define our documents and create a Vectorize index.Create Vectorize Index
You need to create an index in Cloudflare Vectorize. Thedimension should match the output dimension of your embedding model (e.g., 768 for nusa-embedding-0001).