OpenAIPlugin

This plugin provides integration with OpenAI's generative AI models.

A typical JSON request body looks like this:

{
     model : "gpt-4o",
     temperature : 0,
     messages : [
         {
             role = "system",
             content = "You are a helpful assistant"
         }
         {
             role : "user",
             content : "Hello"
         },
         {
             role : "assistant",
             content : "Hi there"
         }
     ]
     tools : [
         {
             function : {
                 name : "add",
                 description : "Add two numbers",
                 parameters : {
                     type : "object",
                     properties : {
                         a : { type : "number", description : "First number" },
                         b : { type : "number", description : "Second number" }
                     },
                     required : ["a", "b"]
                 }
             },
             type : 'function',
             strict : false
         }
     ]
}

A typical text response looks like this

{
  choices : [
     {
         message : {
             role : "assistant",
             content : "Hello! How can I assist you today"
         }
     }
   ]
}

A typical function call response looks like this

{
 choices : [
    {
         message : {
             role : "assistant",
             tool_calls : [
                 {
                     id : "unique-id",
                     type : "function",
                     function : {
                         name : "add",
                         arguments : { a : 1, b : 2 }
                     }
                 }
             ]
         }
     }
    ]
}

And the function call response from the tool should look like this:

{
     role : "tool",
     content : "3",
     tool_call_id : "unique-id"
}

Configs

9

Common

disabledInstancePlugin
listenersEvents

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Other

Properties

17

Common

disabledInstancePlugin

Class hierarchy

isOpenAIPlugin: Boolean= truereadonly
Identifies an object as an instance of OpenAIPlugin class, or subclass thereof.
isOpenAIPlugin: Boolean= truereadonlystatic
Identifies an object as an instance of OpenAIPlugin class, or subclass thereof.
isAbstractApiPluginAbstractApiPlugin
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Other

isApiPluginAbstractApiPlugin

Functions

31

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

beforeApplyTrainingDataAbstractApiPlugin
beforePostAbstractApiPlugin
extractMessageAbstractApiPlugin
LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

5
catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin

Event handlers

5
onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin

Typedefs

6
AIFetchBodyAbstractApiPlugin
AIMessageAbstractApiPlugin
AIToolAbstractApiPlugin
AIToolCallAbstractApiPlugin
AITrainingDataEntryAbstractApiPlugin