---
type: concept
x-llmwiki:
  schemaVersion: "0.1"
  contentHash: 62974c0aa65ac04f1adb8f619741d359e7239c438ed2c6fb0dbf3367b55fb315
  pageDirectory: concepts
  sources:
    - query-an-embedding-model-databricks-on-aws.md
  confidence: 0.96
  provenanceState: extracted
  freshnessStatus: unverified
  aliases:
    - multiple-client-options-for-embedding-queries
    - MCOFEQ
  citations:
    - file: query-an-embedding-model-databricks-on-aws.md
title: Multiple Client Options for Embedding Queries
description: Various client interfaces supported for querying embedding models on Databricks including OpenAI client, SQL, REST API, MLflow Deployments SDK, Databricks Python SDK, and LangChain.
tags:
  - client-options
  - SDK
  - API
  - databricks
timestamp: "2026-06-19T20:02:18.415Z"
---

# Multiple Client Options for Embedding Queries

**Multiple Client Options for Embedding Queries** refers to the variety of client interfaces supported by Databricks for sending embedding requests to foundation models optimized for embeddings tasks. These models are made available through either [Foundation Models APIs](/concepts/foundation-model-apis.md) (Databricks-hosted) or [External Models](/concepts/external-models.md) (hosted outside of Databricks). ^[query-an-embedding-model-databricks-on-aws.md]

## Client Options

Databricks supports multiple client options for querying embedding models, enabling flexible integration based on your workflow and environment preferences. ^[query-an-embedding-model-databricks-on-aws.md]

### OpenAI Client

The OpenAI client provides a simple, standardized interface for embedding requests. Both the `databricks-openai` and `openai` packages are supported.

**Using Databricks OpenAI client** (recommended for in-workspace queries):

```python
from databricks_openai import DatabricksOpenAI

client = DatabricksOpenAI()
response = client.embeddings.create(
  model="databricks-gte-large-en",
  input="what is databricks"
)
```

^[query-an-embedding-model-databricks-on-aws.md]

**Using direct OpenAI client** (for external workspace queries):

```python
import os
import openai
from openai import OpenAI

client = OpenAI(
    api_key="dapi-your-databricks-token",
    base_url="https://example.staging.cloud.databricks.com/serving-endpoints"
)

response = client.embeddings.create(
  model="databricks-gte-large-en",
  input="what is databricks"
)
```

^[query-an-embedding-model-databricks-on-aws.md]

### SQL

SQL-based queries allow embedding requests to be made directly through SQL statements, useful for integration with Databricks SQL workflows. ^[query-an-embedding-model-databricks-on-aws.md]

### REST API

For models made available through pay-per-token [Foundation Models APIs](/concepts/foundation-model-apis.md), embedding requests can be made directly via REST API calls using the expected request format:

```bash
{
  "input": [
    "embedding text"
  ]
}
```

^[query-an-embedding-model-databricks-on-aws.md]

The expected response format:

```json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": []
    }
  ],
  "model": "text-embedding-ada-002-v2",
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2
  }
}
```

^[query-an-embedding-model-databricks-on-aws.md]

For external models, you can include additional parameters that are valid for a given provider and endpoint configuration. See Additional query parameters for details. ^[query-an-embedding-model-databricks-on-aws.md]

### MLflow Deployments SDK

The [MLflow Deployments SDK](/concepts/mlflow-deployments-sdk.md) provides a programmatic interface for managing and querying embedding model deployments. ^[query-an-embedding-model-databricks-on-aws.md]

### Databricks Python SDK

The Databricks Python SDK enables embedding queries within Databricks notebook environments directly. ^[query-an-embedding-model-databricks-on-aws.md]

### LangChain

LangChain integration allows embedding queries to be made within LangChain workflows and applications. ^[query-an-embedding-model-databricks-on-aws.md]

## Requirements

Before using any of the client options, ensure you:
- Meet the Requirements for foundation model serving
- Install the appropriate package to your cluster based on the client option you choose ^[query-an-embedding-model-databricks-on-aws.md]

## Supported Models

See Foundation model types for supported embedding models. ^[query-an-embedding-model-databricks-on-aws.md]

## Checking Embedding Normalization

You can verify whether embeddings generated by your model are normalized using the following utility:

```python
import numpy as np

def is_normalized(vector: list[float], tol=1e-3) -> bool:
    magnitude = np.linalg.norm(vector)
    return abs(magnitude - 1) < tol
```

^[query-an-embedding-model-databricks-on-aws.md]

## Related Concepts

- Query a chat model
- Query reasoning models
- Query vision models
- [Model serving endpoints](/concepts/model-serving-endpoint.md)
- Foundation model types

## Sources

- query-an-embedding-model-databricks-on-aws.md

# Citations

1. [query-an-embedding-model-databricks-on-aws.md](/references/query-an-embedding-model-databricks-on-aws-18956bab.md)
