Perform Text Embedding

This handler (com.rierino.handler.langchain4j.EmbeddingEventHandler) provides ability to convert text into embedding for advanced search functionality

Handler Parameters

Parameter
Definition
Example
Default

model.store.system

Name of the system to get model details from

model_fs

A default huggingface repo

model.path

File path for the model to use

/model.onnx

A default ONNX model

tokenizer.path

File path for the tokenizer to use

/tokenizer.json

A default tokenizer

model.local.dir

Local directory to store downloaded model files

/app/models

System temp dir

This handler requires the following dependency added to deployment contents:

implementation (group:'com.rierino.custom', name: 'langchain4j', version:"${rierinoVersion}")

Actions

EmbedText

Transforms text into an embedding. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

inputElement

Json path for the input in request event payload

input

-

outputElement

Json path for the output in response event payload

output

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESpath pattern to apply on input element for getting text and metadata fields

{text: "", metadata: ""}

-

extraAction

Optional extra action to perform after generating embedding ("add" to local index, "search" in local index)

add

-

maxResults

Maximum results to return if "search" extra action is used

5

-

minScore

Minimum similarity score required if "search" extra action is used

0.5

-

Input element can be a text value, or an object in {chat, message} format, where "chat" field includes ID of an ongoing chat for an assistant type use case with memory.

Last updated