Skip to main content

Reference

The below is a reference for the Apex classes involved in invoking the AI/LLM functionality within Seven20. All methods defined in classes are global, and any implementer of an interface must also be defined as global, including any methods in the interface it implements.

Namespaced References
All classes and interfaces belong to the seven20 namespace, and as such should be prefixed with seven20 when used. e.g. seven20.GlobalClass

LargeLanguageModelService

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Class which provides the mechanism for invoking the LLM functionality by providing it a fully formed request.

MethodReturn TypeDescription
invokeRequest( LargeLanguageModelTextGenerator.Request request)LargeLanguageModelTextGenerator.ResponseInvokes the LLM request. This is a synchronous callout and will block until a response is received

LargeLanguageModelTextGenerator.Request

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Interface which defines a new model to be used for a request.

MethodReturn TypeDescription
responseType()System.TypeReturns the Type of the response, for use in parsing. This type must implement the LargeLanguageModelTextGenerator.Response interface
getHttpRequest()HttpRequestReturns the HTTP request to be sent to the LLM endpoint. This should be a valid request for the model being used

LargeLanguageModelTextGenerator.Response

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Interface which defines the response from an LLM request.

MethodReturn TypeDescription
processResponse(HttpResponse response)voidProcesses the response from the LLM request. This should parse the response and set the properties of the class. This method is called after the object has been initialised and should handle any errors/exceptions that may be thrown during parsing
isSuccess()BooleanReturns true if the request was successful, which should be determined in the processResponse() method call
getErrors()List<LargeLanguageModelTextGenerator.Error>Returns a list of errors that occurred during the request. This should be set in the processResponse() method call. If there are no errors, this should return an empty list
getResult()List<LargeLanguageModelTextGenerator.Result>Returns the results of the request. This should be set in the processResponse() method call. If there is no result, this should return an empty list
tip

The response type can be reused across multiple LLM requests if they require the same post-request parsing.

LargeLanguageModelTextGenerator.ChatMessage

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Interface which defines a message to be sent to the LLM.

MethodReturn TypeDescription
getMessage()ObjectReturns the message to be sent to the LLM. This should be a JSON serializable object

LargeLanguageModelTextGenerator.Result

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Interface which defines a result message from an LLM request.

MethodReturn TypeDescription
getMessage()StringReturns the message from the LLM
tip

If the LLM's output is intended to be user-facing, it's best to return a human-readable string, otherwise return JSON for further processing downstream.

LargeLanguageModelTextGenerator.Error

Work In Progress
This interface is not currently global and is included here for future reference as part of custom models.

Interface which defines an error from an LLM request.

MethodReturn TypeDescription
getMessage()StringReturns the message from the LLM
tip

If the LLM's output is intended to be user-facing, it's best to return a human-readable string, otherwise return JSON for further processing downstream.

FlowLlmTextGenAction

Invocable Apex class which can be called within a Flow, or directly within Apex.

MethodReturn TypeDescription
invoke(List<FlowLlmTextGenAction.Request> requests)List<FlowLlmTextGenAction.Response>Invokes the LLM request. Result indexes match the input indexes when more than one input request is provided

FlowLlmTextGenAction.Request

Class defining the inputs of an LLM request. All values are required.

PropertyFlow NameTypeDescription
modelModelStringThe model to be used for the request. This should be a valid implementer of the LargeLanguageModelTextGenerator.Request interface
messagesGeneration Request PromptsList<FlowLlmTextGenMessage>The messages to be sent to the LLM. All list members must be valid

FlowLlmTextGenAction.Response

Class defining the response of an LLM request.

PropertyFlow NameTypeDescription
isSuccessIs Success?BooleanTrue if the request was successful
valueValueStringMessage from the LLM, or if an error occurred, the error message

FlowLlmTextGenMessage

Class defining a message to be sent to the LLM. All values are required.

PropertyTypeDescription
roleStringThe role of the message. The specific values depend on the model which will be invoked, see their documentation for reference
contentStringThe content of the message