Documentation > AI-RAG-NLP-API > Create embeddings for a given payload, to be used in any application.

Opensolr API Endpoint: embed

Overview

The embed endpoint allows you to generate vector embeddings for any arbitrary text payload (up to 50,000 characters) and store those embeddings in your specified Opensolr index. This is ideal for embedding dynamic or ad-hoc content, without having to pre-index data in Solr first.


Endpoint URL

https://api.opensolr.com/solr_manager/api/embed

Supports only POST requests.


Authentication & Core Parameters

Parameter Type Required Description
email string Yes Your Opensolr registration email address.
api_key string Yes Your API key from the Opensolr dashboard.
index_name string Yes Name of your Opensolr index/core to use.

Embedding Parameters

Parameter Type Required Default Description
payload string Yes The raw text string to embed. Maximum: 50,000 characters.

Special Notes

  • payload can be any UTF-8 text (e.g., a document, user input, generated content, etc).
  • If payload is missing or less than 2 characters, the API returns a 404 error with a JSON error response.
  • You must specify a valid index_name to indicate where the embedding should be stored (requires the appropriate field in your Solr schema).
  • The response is returned as JSON.

Example Solr Schema Requirement

To store embeddings, your Solr schema must define an appropriate vector field, for example:

<field name="embeddings" type="vector" indexed="true" stored="false" multiValued="false"/>
<fieldType name="vector" class="solr.DenseVectorField" vectorDimension="384" required="false" similarityFunction="cosine"/>

Adjust the name, type, and vectorDimension as needed to fit your use-case and model.


Example Usage

Example: POST Request

POST https://api.opensolr.com/solr_manager/api/embed
Content-Type: application/x-www-form-urlencoded

[email protected]&api_key=YOUR_API_KEY&index_name=your_index&payload=Your text to embed here.

Endpoint Behavior

  1. Authenticates the user using email and api_key.
  2. Checks for a valid payload parameter (must be 2-50,000 characters).
  3. Generates vector embeddings for the provided payload.
  4. Stores the generated embedding in the specified Solr index.
  5. Responds with a JSON object containing the result.

Example Response

{
  "status": "success",
  "embedding": [/* vector values */],
  "length": 4381
}

Or, for invalid input:

{
  "ERROR": "Invalid payload"
}

Use Cases

  • Embed dynamic or user-generated text into your Solr index.
  • Integrate with chatbots, summarization tools, or any app needing AI-powered semantic representations on the fly.
  • Test or debug embedding functionality before bulk-embedding large datasets.

Support

For more information or help, visit Opensolr Support or use your Opensolr dashboard.







Review us on Google Business
ISO-9001 CERTIFIED ISO-27001 CERTIFIED