ModelEncode
Returns embeddings for the text that you specify, based on the configured model that you specify.
The action also returns offset information, if available, as an attribute of the vector. for example:
<autn:vector start="1" end="48" length="48">1,2,3,4,...</autn:vector>
Offset information is always available when the Model is SentenceTransformer type. It is available for Lua script models only if you return them from the script. See Script.
The action can return more than one <autn:vector>
tag, if there are multiple embeddings for your text.
Required Parameters
The following action parameters are required.
Parameter | Description |
---|---|
Model | The configured model to use to generate embeddings. |
Text | The text to generate an embedding for. |
Optional Parameters
This action accepts the following standard ACI action parameters.
Parameter | Description |
---|---|
ActionID | A string to use to identify an ACI action. |
FileName | The file to write output to. |
ForceTemplateRefresh | Forces the server to load the template from disk. |
Output | Writes output to a file. |
ResponseFormat | The format of the action output. |
Template | The template to use for the action output. |
TemplateParamCSVs | A list of variables to use for the specified template. |
Example
The following action encodes an embedding for the text "if music be the food of love play on", using the configured SentenceTransformer
model.
http://qms:16000/action=ModelEncode&Text=if%20music%20be%20the%20food%20of%20love%20play%20on&Model=SentenceTransformers