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.
| Property | Value |
|---|---|
| Method | POST |
| Content-Type | application/json |
| Service | Azure OpenAI (direct API call) |
| API Version | 2024-02-01 |
| Model | Use the same embedding model used during document ingestion (e.g. text-embedding-3-small → 1536 dims) |
https://my-resource.openai.azure.com/text-embedding-3-small
Azure OpenAI API Key
api-key{{openAI_Key}}| Field | Type | Required | Description |
|---|---|---|---|
| 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?"
}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"
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
}
}api-key.input field missing or value exceeds token limit.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.