Introducing the SentenceTransformers API

Introducing the SentenceTransformers API

Acknowledging the rising significance of transformer models in Natural Language Processing (NLP) and the distinct requirement for sentence-level embeddings, we're thrilled to announce the integration of models from the SentenceTransformers library into our embeddings API! Our primary objective with this incorporation is to endow you with state-of-the-art AI solutions all under one roof.

Embaas - Embeddings as a service

At Embaas, our goal is to equip you with all the essential tools such as embeddings and document extraction services. We aim to streamline your AI tool creation and development pipeline.

SentenceTransformers: Why It Matters

SentenceTransformers is a powerful extension of the renowned transformers library, precisely optimized for deriving high-quality vector representations of sentences. It utilizes the strength of transformer architectures, such as BERT, RoBERTa, and DistilBERT, to create meaningful sentence-level embeddings. This step brings us closer to a more accurate understanding of the subtleties of human language.

The ability of SentenceTransformers to encapsulate entire sentences into dense vectors is invaluable. These vectors encapsulate semantic meaning and relationships, which are often challenging to interpret using traditional word-level embeddings. Consequently, it becomes an influential tool for semantic similarity comparison, text clustering, and information retrieval.

Our API's Integration with SentenceTransformers

Integrating SentenceTransformers into your project has never been easier. All you need to do is to send a POST request to our embedding endpoint with your sentences and chosen model. Our service will promptly return the embeddings or similarity scores. Here's an example POST request:

Example Request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import requests

    url = "https://api.embaas.io/v1/embeddings/"

    headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer {EMBAAS_API_KEY}"
    }

    data = {
      "texts": ["This is an example sentence.", "Here is another sentence."],
      "model": "all-MiniLM-L6-v2"
    }

    response = requests.post(url, json=data, headers=headers)

And here is a sample response:

Example Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  "data": [
    {
      "embedding": [0.1, 0.2, ...],
      "index": 0,
      "object": "embedding"
    },
    {
      "embedding": [-0.1, 0.3, ...],
      "index": 1,
      "object": "embedding"
    }
  ],
  "model": "all-MiniLM-L6-v2",
  "object": "list",
  "usage": {
    "prompt_tokens": 10,
    "total_tokens": 10
  }
}

API Flexibility and Performance

Our API provides the flexibility to select from a range of pre-trained models like instructor-large, paraphrase-MiniLM-L6-v2, e5-large-v2 and more! Each model carries unique strengths and trade-offs concerning computational requirements and task performance. Please check out the complete list of available models for more information. You can specify your preferred model in the API request, and our service will generate embeddings using your selected model. If a model you need is not listed, do reach out to us, and we will promptly include it.

We've invested significant efforts to optimize our API's performance, ensuring low latency and high throughput. Rest assured, our API is designed to scale seamlessly with your evolving needs.

Let us know what you think.

We're offering free credits so that you can thoroughly test and evaluate our service. We eagerly look forward to your feedback as we are at the nascent stage and strive to improve our service continually.

Feel free to share your thoughts. Join our Discord or write us an email!


Happy embedding 🚀.