← Back to APIs
RAG PIPELINE — VECTOR SEARCH PREP

Get Question Embedding

Before running a vector search, you need to convert the user's question into the same kind of embedding vector that was stored during document ingestion. This API calls the Azure OpenAI Embeddings endpoint and returns a 1536-dimension float vector. You then pass this vector directly into the Vector Search API (Step 6) to find semantically similar document chunks.

POST · Azure OpenAI 1536-dim Embedding Vector Variables: openAI_Endpoint, openAI_Key, openAI_EmbeddingModelName
01

Endpoint

POST {{openAI_Endpoint}}openai/deployments/{{openAI_EmbeddingModelName}}/embeddings?api-version=2024-02-01
PropertyValue
MethodPOST
Content-Typeapplication/json
ServiceAzure OpenAI (direct API call)
API Version2024-02-01
ModelUse the same embedding model used during document ingestion (e.g. text-embedding-3-small → 1536 dims)
02

Postman Collection Variables Required

Set these variables in the Postman collection before calling this API openAI_Endpoint — Your Azure OpenAI base URL, e.g. https://my-resource.openai.azure.com/
openAI_Key — Your Azure OpenAI API key
openAI_EmbeddingModelName — Your embedding deployment name, e.g. text-embedding-3-small
03

Authentication

Azure OpenAI API Key

Header: api-key{{openAI_Key}}
04

Request Body

FieldTypeRequiredDescription
input String Required The question or text to embed. This should be the user's search query or question.

Request Body (from Postman collection)

{
  "input": "What is this document all about?"
}
05

Sample Request

cURL

curl -X POST \
  -H "api-key: <your-azure-openai-key>" \
  -H "Content-Type: application/json" \
  -d '{"input":"What is this document all about?"}' \
  "https://<resource>.openai.azure.com/openai/deployments/text-embedding-3-small/embeddings?api-version=2024-02-01"
06

Response — 200 OK

Use the embedding array in Vector Search Copy the entire data[0].embedding array from the response and paste it as the vector field in the Vector Search API request body.

Sample Response

{
  "object": "list",
  "data": [
    {
      "object"   : "embedding",
      "index"    : 0,
      "embedding": [ 0.0198974609375, 0.055816650390625, -0.041198730468750, ... ]  // 1536 floats
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens" : 8
  }
}
07

Error Responses

200
OK — 1536-dim embedding vector returned.
401
Unauthorized — Invalid or missing api-key.
404
Not Found — Deployment name not found in your Azure OpenAI resource.
400
Bad Request — input field missing or value exceeds token limit.
08

Next Step in RAG Pipeline

Step 6 — Use the vector in Vector Search Copy data[0].embedding from this response and use it as the vector value in the Vector Search request body to find the most similar document chunks.