Class CallableFunction

Hierarchy

  • CallableFunction

Constructors

  • Parameters

    • name: string

      The name of the callable function. This name will be used by the AI assistant.

    • Optional description: string

      A description of the callable function. While optional, it is strongly recommended to provide a description.

    • Optional parameters: {
          $comment?: string;
          additionalProperties?: boolean | JsonSchema;
          default?: any;
          deprecated?: boolean;
          description?: string;
          examples?: any[];
          maxProperties?: number;
          minProperties?: number;
          patternProperties?: Record<string, JsonSchema>;
          properties?: Record<string, JsonSchema>;
          readOnly?: boolean;
          required?: string[];
          title?: string;
          type: "object";
          unevaluatedProperties?: boolean;
          writeOnly?: boolean;
      } | CallableFunctionObject

      The initial parameters of the callable function.

    Returns CallableFunction

Properties

description?: string

A description of the callable function. While optional, it is strongly recommended to provide a description.

id: string = ...

A UUID generated for this function by the library.

name: string

The name of the callable function. This name will be used by the AI assistant.

Accessors

  • get optionalParameters(): CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]
  • The list of optional CallableFunctionParameter instances.

    Returns CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]

  • get parameters(): CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]
  • The list of CallableFunctionParameter instances.

    Returns CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]

  • get requiredParameters(): CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]
  • The list of required CallableFunctionParameter instances.

    Returns CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>[]

Methods

  • Adds a parameter to the object.

    Parameters

    • parameterOrSchema: CallableFunctionParameter<{
          $comment?: string;
          default?: any;
          deprecated?: boolean;
          description?: string;
          examples?: any[];
          readOnly?: boolean;
          title?: string;
          writeOnly?: boolean;
      }> | Object

      The parameter to add or the JsonSchema of the parameter and its name to add.

    • required: boolean = false

      Whether the parameter is required.

    Returns CallableFunction

    this

  • Gets a parameter by name.

    Parameters

    • name: string

      The name of the parameter to get.

    Returns undefined | CallableFunctionParameter<{
        $comment?: string;
        default?: any;
        deprecated?: boolean;
        description?: string;
        examples?: any[];
        readOnly?: boolean;
        title?: string;
        writeOnly?: boolean;
    }>

    The parameter with the given name, or undefined if it does not exist.

  • Serializes the callable function to JSON.

    Returns {
        description?: string;
        id?: string;
        name: string;
        parameters?: {
            $comment?: string;
            additionalProperties?: boolean | JsonSchema;
            default?: any;
            deprecated?: boolean;
            description?: string;
            examples?: any[];
            maxProperties?: number;
            minProperties?: number;
            patternProperties?: Record<string, JsonSchema>;
            properties?: Record<string, JsonSchema>;
            readOnly?: boolean;
            required?: string[];
            title?: string;
            type: "object";
            unevaluatedProperties?: boolean;
            writeOnly?: boolean;
        };
    }

    The CallableFunction as a JSON object.

    • Optional description?: string
    • Optional id?: string
    • name: string
    • Optional parameters?: {
          $comment?: string;
          additionalProperties?: boolean | JsonSchema;
          default?: any;
          deprecated?: boolean;
          description?: string;
          examples?: any[];
          maxProperties?: number;
          minProperties?: number;
          patternProperties?: Record<string, JsonSchema>;
          properties?: Record<string, JsonSchema>;
          readOnly?: boolean;
          required?: string[];
          title?: string;
          type: "object";
          unevaluatedProperties?: boolean;
          writeOnly?: boolean;
      }
      • Optional $comment?: string
      • Optional additionalProperties?: boolean | JsonSchema
      • Optional default?: any
      • Optional deprecated?: boolean
      • Optional description?: string
      • Optional examples?: any[]
      • Optional maxProperties?: number
      • Optional minProperties?: number
      • Optional patternProperties?: Record<string, JsonSchema>
      • Optional properties?: Record<string, JsonSchema>
      • Optional readOnly?: boolean
      • Optional required?: string[]
      • Optional title?: string
      • type: "object"
      • Optional unevaluatedProperties?: boolean
      • Optional writeOnly?: boolean
  • Creates a new CallableFunction instance from a serialized callable function.

    Parameters

    • json: {
          description?: string;
          id?: string;
          name: string;
          parameters?: {
              $comment?: string;
              additionalProperties?: boolean | JsonSchema;
              default?: any;
              deprecated?: boolean;
              description?: string;
              examples?: any[];
              maxProperties?: number;
              minProperties?: number;
              patternProperties?: Record<string, JsonSchema>;
              properties?: Record<string, JsonSchema>;
              readOnly?: boolean;
              required?: string[];
              title?: string;
              type: "object";
              unevaluatedProperties?: boolean;
              writeOnly?: boolean;
          };
      }

      The JSON object of the CallableFunction instance.

      • Optional description?: string
      • Optional id?: string
      • name: string
      • Optional parameters?: {
            $comment?: string;
            additionalProperties?: boolean | JsonSchema;
            default?: any;
            deprecated?: boolean;
            description?: string;
            examples?: any[];
            maxProperties?: number;
            minProperties?: number;
            patternProperties?: Record<string, JsonSchema>;
            properties?: Record<string, JsonSchema>;
            readOnly?: boolean;
            required?: string[];
            title?: string;
            type: "object";
            unevaluatedProperties?: boolean;
            writeOnly?: boolean;
        }
        • Optional $comment?: string
        • Optional additionalProperties?: boolean | JsonSchema
        • Optional default?: any
        • Optional deprecated?: boolean
        • Optional description?: string
        • Optional examples?: any[]
        • Optional maxProperties?: number
        • Optional minProperties?: number
        • Optional patternProperties?: Record<string, JsonSchema>
        • Optional properties?: Record<string, JsonSchema>
        • Optional readOnly?: boolean
        • Optional required?: string[]
        • Optional title?: string
        • type: "object"
        • Optional unevaluatedProperties?: boolean
        • Optional writeOnly?: boolean

    Returns CallableFunction

    A new CallableFunction instance

Generated using TypeDoc