Action that executes MemberJunction AI prompts

Example

// Execute a simple prompt
await runAction({
ActionName: 'Execute AI Prompt',
Params: [{
Name: 'PromptName',
Value: 'Summarize Text'
}, {
Name: 'Variables',
Value: {
text: 'Long article text here...',
maxLength: 200
}
}]
});

// Execute with model override
await runAction({
ActionName: 'Execute AI Prompt',
Params: [{
Name: 'PromptName',
Value: 'Generate Code'
}, {
Name: 'Variables',
Value: {
language: 'TypeScript',
description: 'Function to calculate fibonacci'
}
}, {
Name: 'ModelOverride',
Value: 'gpt-4'
}, {
Name: 'TemperatureOverride',
Value: 0.7
}]
});

// Execute with streaming
await runAction({
ActionName: 'Execute AI Prompt',
Params: [{
Name: 'PromptName',
Value: 'Creative Writing'
}, {
Name: 'Variables',
Value: { topic: 'space exploration' }
}, {
Name: 'Stream',
Value: true
}]
});

Hierarchy (view full)

Constructors

Methods

  • Executes a MemberJunction AI prompt

    Parameters

    • params: RunActionParams<any>

      The action parameters containing:

      • PromptName: Name of the AI prompt to execute (required)
      • Variables: Object with variables for the prompt (optional)
      • ModelOverride: Override the default model (optional)
      • TemperatureOverride: Override temperature setting (optional)
      • MaxTokensOverride: Override max tokens (optional)
      • Stream: Boolean - stream responses (default: false)
      • SystemPromptOverride: Override system prompt (optional)
      • IncludeMetadata: Include prompt metadata in response (default: false)

    Returns Promise<ActionResultSimple>

    AI prompt response

  • Executes the action with the provided parameters.

    Parameters

    • params: RunActionParams<any>

      The action execution parameters including context

    Returns Promise<ActionResultSimple>

    Promise resolving to the action result