Sentence Embeddings Webserver

We've started up a webserver that provides a simple HTTP API (with only one method) that enables you to generate concatenated p-mean sentence embeddings.

The current loaded model is "{{ model_name }}".

API: Convert Sentences to Embeddings

This is the only endpoint of our API. You can pass a list of sentences for which concatenated p-mean sentence embeddings will be generated. We recommend a maximum number of 500 sentences per request. Sentences should be already tokenized (tokens separated by spaces).

POST /embed
Parameter Description
conversion

A JSON string that contains input sentences and a list of embedding types and p-means that should be concatenated:

{
    {%- if model_name.startswith('en') %}
    'sentences': ['first_en sentence_en', 'second_en sentence_en'],
    {%- else %}
    'sentences': ['first sentence', 'second sentence'],
    {%- endif %}
    'embedding_types': [
        {%- for e in embeddings %}
        ('{{ e.alias }}', ['mean', 'min', 'max', 'p_mean_3']),
        {%- endfor %}
    ]
}

Available embeddings: {% for e in embeddings %} {{ e.alias }} {% endfor %}
Available p-means: {% for op in operations %} {{ op }} {% endfor %}

Response
One sentence embedding per line that corresponds to the ith input sentence.

Example Code: Python Request Builder

Here you can generate python code to query the API with the chosen embeddings and p-means!

Word Embeddings {%- for e in embeddings %}
{%- endfor %}
p-means {%- for op in operations %}
{%- endfor %}
Generated Code