IBM Cloud Platform as a Service

IBM Cloud Platform as a Service

Join us to learn more from a community of collaborative experts and IBM Cloud product users to share advice and best practices with peers and stay up to date regarding product enhancements, regional user group meetings, webinars, how-to blogs, and other helpful materials.

 View Only

Build Search, RAG, and Semantic AI Applications with the New Embeddings API in Red Hat AI Inference on IBM Cloud

By Riona Fernandes posted 10/09/26 09:58 AM

  
By Riona Fernandes and Tucker Troyer

Generative AI applications need more than the ability to generate text.
Enterprise assistants, retrieval-augmented generation applications, semantic search engines, recommendation systems, and intelligent agents all need a reliable way to understand how pieces of information relate to one another. That is where embeddings come in.
We are excited to announce support for the Embeddings API in Red Hat AI Inference on IBM Cloud.
With this new capability, developers can convert text into numerical vector representations through a familiar, OpenAI-compatible API. Those vectors can then be stored, compared, and searched to help applications find relevant information based on meaning rather than exact keyword matches.
Red Hat AI Inference on IBM Cloud already gives developers managed access to foundation models through familiar APIs, including chat completions and model discovery. The addition of embeddings expands the service beyond text generation and enables developers to build complete, production-oriented generative AI workflows using a consistent API and authentication model.

What are embeddings?

An embedding is a numerical representation of content, typically expressed as an array of floating-point values.
Texts with similar meanings tend to produce vectors that are mathematically close to one another. For example, “How do I reset my password?” and “I cannot access my account” may not contain the same words, but an embedding model can represent them as semantically related.
Applications can compare these vectors by using techniques such as cosine similarity or can store them in a vector database for efficient similarity searches across large collections of information.
This makes embeddings useful for:
  • Semantic search
  • Retrieval-augmented generation, or RAG
  • Document discovery
  • Knowledge-base assistants
  • Content recommendations
  • Document classification and clustering
  • Duplicate-content detection
  • Context retrieval for AI agents
In short: chat completion models generate responses, while embedding models help applications find and organize the information needed to produce better-grounded responses.

Why embeddings matter for RAG

Retrieval-augmented generation is one of the most common patterns for applying generative AI to enterprise information.
In a typical RAG workflow, an application:
  1. Divides source documents into smaller passages or chunks.
  2. Sends each passage to an embedding model.
  3. Stores the resulting vectors with the original text in a vector database.
  4. Creates an embedding for the user’s question.
  5. Searches for the closest document vectors.
  6. Adds the most relevant passages to a prompt.
  7. Sends the grounded prompt to a chat completion model.
This pattern helps a generative model respond with information retrieved from an organization’s own documents, product manuals, support content, policies, or application data.
The Embeddings API provides the vector-generation step through the same Red Hat AI Inference service developers can use for model discovery and chat completions. This gives teams a simpler path to combining retrieval and generation in one application architecture.

A familiar API for developers

Red Hat AI Inference on IBM Cloud is designed around familiar API patterns so that developers can use established tools, SDKs, and application frameworks. Existing chat workloads use the OpenAI-compatible /v1/chat/completions endpoint, while models can be discovered through /v1/models.
With the new Embeddings API, applications can submit text to:
/v1/embeddings

The request identifies an embedding model and provides one or more strings as input. The response contains the corresponding embedding vector for each input.
The service uses IBM Cloud Identity and Access Management for authentication. Requests can use an IBM Cloud API key or bearer token, subject to the IAM roles assigned to the caller.

Try it with curl

Before making a request, you will need:
  • A paid IBM Cloud account
  • A Red Hat AI Inference project
  • An appropriate IAM role for the service
  • An IBM Cloud API key or bearer token
  • An embedding model available in your project
The IBM Cloud API documentation identifies the regional project endpoint in this form:
https://us-east.rhai.ibm.com/v1/projects/<project_id>

1. Set your environment variables

export IBM_CLOUD_API_KEY="<your_ibm_cloud_api_key>"
export PROJECT_ID="<your_project_id>"
export EMBEDDING_MODEL="<embedding_model_id>"
Replace
<embedding_model_id> with the exact identifier shown in your project’s model catalog.

2. List the available models

Before generating an embedding, you can list the models available to your project:
curl \
  "https://us-east.rhai.ibm.com/v1/projects/${PROJECT_ID}/inference/v1/models" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${IBM_CLOUD_API_KEY}"

Model metadata in the Red Hat AI Inference API indicates whether a model supports embeddings through the
supports_embeddings field. Applications can use this information to identify models that are suitable for the embedding stage of a retrieval and generation workflow.

3. Create an embedding

Send text to the embeddings endpoint:
curl \
  "https://us-east.rhai.ibm.com/v1/projects/${PROJECT_ID}/inference/v1/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${IBM_CLOUD_API_KEY}" \
  -d '{
    "model": "'"${EMBEDDING_MODEL}"'",
    "input": [
      "Red Hat AI Inference on IBM Cloud provides managed access to AI models."
    ]
  }' \
  | jq '.data[0].embedding'

The response follows the familiar embeddings pattern and includes a vector for each input:
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.0123,
        -0.0456,
        0.0789
      ]
    }
  ],
  "model": "<embedding_model_id>",
  "usage": {
    "prompt_tokens": 12,
    "total_tokens": 12
  }
}

The values above are illustrative. The actual vector size and values depend on the selected embedding model.
Applications typically store the returned vector alongside the original content and its metadata. When a user submits a query, the application creates another embedding and searches for the stored vectors that are closest to it.

From semantic retrieval to grounded generation

The Embeddings API becomes even more valuable when combined with chat completions.
After retrieving the most relevant passages from a vector store, an application can construct a grounded prompt and send it to a model through:
/v1/chat/completions

This lets development teams use an embedding model for retrieval and an instruction-tuned foundation model for generation. Models such as Granite can then use the retrieved enterprise context to answer questions, summarize documents, or support agentic workflows. Red Hat AI Inference on IBM Cloud offers this through a managed service intended to reduce the need for teams to operate GPU infrastructure and model-serving platforms themselves.

Build more complete AI applications

Support for the Embeddings API is an important expansion of Red Hat AI Inference on IBM Cloud.
Developers can now use familiar API patterns to build semantic search, RAG, recommendations, classification, and agent memory workflows alongside conversational and generative AI experiences. Platform teams can provide common access to these capabilities while maintaining IBM Cloud IAM-based access controls and a consistent project context.
Whether you are adding semantic search to an existing application or building a new enterprise RAG solution, the Embeddings API provides a straightforward way to turn unstructured text into vectors that applications can retrieve, compare, and use.
To get started:
  1. Create or open a Red Hat AI Inference project.
  2. Review the embedding models available in the model catalog.
  3. Configure your project ID and IBM Cloud credentials.
  4. Call /v1/embeddings with your text.
  5. Store the returned vectors in your preferred vector database.
  6. Combine retrieval with /v1/chat/completions to build a grounded generative AI experience.
Visit the Red Hat AI Inference on IBM Cloud documentation and API reference for current prerequisites, authentication guidance, available models, and request details.
0 comments
21 views

Permalink