Generate Embeddings with QMS

You generate embeddings in QMS by using the ModelEncode action. You specify the configured model to use by setting the Model parameter to the name of the embeddings configuration section. You set the text that you want to generate embeddings for in the Text parameter.

NOTE: The first time you use a particular Model, QMS downloads and caches it.

If QMS does not have an internet connection, you can use this action only if you have an existing cached model.

For example:

http://qms:16000/action=ModelEncode&Text=if%20music%20be%20the%20food%20of%20love%20play%20on&Model=SentenceTransformers

This example uses the SentenceTransformer model to generate embeddings for the text if music be the food of love play on.

The action returns the embeddings in one or more <autn:vector> tags in the XML response:

<autn:vector start="1" end="37" length="37">1,2,3,4,...</autn:vector>

The start and end attributes are the offsets that show the location of the text that the vector represents starts and ends in your original text. The length attribute is the length of the text that the vector represents. These attributes always return for embeddings models of the Transformer Type. For Lua models, these attributes return only if your Lua script returns the offset values.

The unit of the offset and length values depends on what your model returns.