Function systemPrompt

  • Class-level systemPrompt decorator.

    Use this decorator to add a static system prompt to the entire class. The provided system prompt will be prepended to the list of system prompts for the class.

    Usage:

    @systemPrompt("Static system prompt.")
    class ExampleClass {
    // Class implementation
    }

    Parameters

    • prompt: string

      A static system prompt string to associate with the class.

    Returns ClassDecorator

    A class decorator function.

  • Method-level systemPrompt decorator.

    Use this decorator on methods to dynamically provide a system prompt. The method must return a string or a Promise resolving to a string, which will be added to the list of system prompts for the class.

    Usage:

    class ExampleClass {
    @systemPrompt
    async dynamicPromptMethod(): Promise<string> {
    return "Dynamic system prompt from the method.";
    }
    }

    Returns MethodDecorator

    A method decorator function.

    An error if applied to a property or a method that does not return a string.