Skip to main content
All templates

Two ways to use this template

Use with your coding agent
  1. 1. Click "Copy prompt" below
  2. 2. Paste into Cursor, Claude Code, Codex, or any coding agent
  3. 3. Your agent builds the app — it asks questions along the way so the result is exactly what you want
or
Read step-by-step

Follow the steps below to set things up manually, at your own pace.

Generate Embeddings with AI Gateway

Generate text embeddings from a Databricks AI Gateway endpoint using the Databricks SDK.

Generate text embeddings from a Databricks AI Gateway endpoint using the Databricks SDK.

When done, you will have:

  • A configured embedding endpoint in your app environment
  • A reusable helper function that generates vector embeddings from text input
  • Integration with your existing Databricks workspace client via AppKit

Prerequisites

Verify these Databricks workspace features are enabled before starting. If any check fails, ask your workspace admin to enable the feature.

  • Databricks CLI authenticated. Run databricks auth profiles and confirm at least one profile shows Valid: YES. If none do, authenticate with databricks auth login --host <workspace-url> --profile <PROFILE>.
  • An embedding endpoint in Model Serving. Run databricks serving-endpoints list --profile <PROFILE> and confirm at least one embedding endpoint is listed (for example databricks-gte-large-en or databricks-bge-large-en, both 1024-dimension). Endpoint availability varies by workspace; note the endpoint name you plan to set as DATABRICKS_EMBEDDING_ENDPOINT.

Generate Embeddings with AI Gateway

Generate text embeddings from a Databricks AI Gateway endpoint using the Databricks SDK.

1. Find an embedding endpoint

bash
databricks serving-endpoints list --profile <PROFILE>

Common embedding endpoints: databricks-gte-large-en (1024d), databricks-bge-large-en (1024d).

2. Configure environment

.env:

bash
DATABRICKS_EMBEDDING_ENDPOINT=databricks-gte-large-en

app.yaml:

yaml
env:
- name: DATABRICKS_EMBEDDING_ENDPOINT
value: "databricks-gte-large-en"

3. Embedding helper

Create server/lib/embeddings.ts:

typescript
import { getWorkspaceClient } from "@databricks/appkit";

const workspaceClient = getWorkspaceClient({});

export async function generateEmbedding(text: string): Promise<number[]> {
const endpoint =
process.env.DATABRICKS_EMBEDDING_ENDPOINT || "databricks-gte-large-en";
const result = await workspaceClient.servingEndpoints.query({
name: endpoint,
input: text,
});
return result.data![0].embedding!;
}

No additional dependencies — uses @databricks/appkit already in your project.

4. Verify

bash
databricks serving-endpoints query <embedding-endpoint> \
--json '{"input": "Hello, world!"}' \
--profile <PROFILE>

Response includes a data array with embedding (float array).

References