Score LangChain Models
This handler (com.rierino.handler.langchain4j.LangChainModelEventHandler) provides ability to use LangChain models from various providers
Handler Parameters
model.state
Name of the state manager with model configurations
genai_model
-
model.domain
Name of the model domain to include
chat
-
This handler requires the following dependency (as well as LLM provider specific LangChain4J dependencies) added to deployment contents:
Models
Models used by this event handler are stored in a regular state manager with the following model parameters:
Class: Java class name for the LLM provider model (e.g. dev.langchain4j.model.openai.OpenAiChatModel)
Methods: List of methods and their parameters to call for initializing LLM provider model (e.g. { "apiKey": ["TBD"] } )
Memory: State manager that should serve as the memory for assistants.
Memory Size: Maximum number of messages to retain in assistant's memory.
Actions
LLMChat
Performs a chat interaction with a target LLM model provider. Event metadata fields applicable for this action are as follows:
inputElement
Json path for the input in request event payload
message
-
outputElement
Json path for the output in response event payload
output
-
With event metadata parameters as:
model
ID of the model to use
chatgpt_chat
-
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.
LLMGenerateImage
Performs an image generation with a target LLM model provider. Event metadata fields applicable for this action are as follows:
inputElement
Json path for the input in request event payload
{prompt: "", imageCount: ""}
-
outputElement
Json path for the output in response event payload
imageBase64
-
With event metadata parameters as:
model
ID of the model to use
dalle_gen
-
LLMEditImage
Performs an image edit with a target LLM model provider. Event metadata fields applicable for this action are as follows:
inputElement
Json path for the input in request event payload
{prompt: "", image: { revisedPrompt: "", base64Data:"", mimeType: "", url: ""}, mask: ""}
-
outputElement
Json path for the output in response event payload
output
-
With event metadata parameters as:
model
ID of the model to use
dalle_edit
-
Last updated