Score LangChain Models

This handler (com.rierino.handler.langchain4j.LangChainModelEventHandler) provides ability to use LangChain models from various providers

Handler Parameters

Parameter
Definition
Example
Default

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:

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

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:

Field
Definition
Example
Default

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:

Parameter
Definition
Example
Default

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:

Field
Definition
Example
Default

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:

Parameter
Definition
Example
Default

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:

Field
Definition
Example
Default

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:

Parameter
Definition
Example
Default

model

ID of the model to use

dalle_edit

-

Last updated