Properties of the Nestia Agent.

INestiaAgentProps is an interface that defines the properties of the NestiaAgent.constructor. In the INestiaAgentProps, there're everything to prepare to create a Super A.I. chatbot performing the LLM (Large Language Model) function calling.

At first, you have to specify the LLM service provider like OpenAI with its API key and client API. And then, you have to define the controllers serving the functions to call. The controllers are separated by two protocols; HTTP API and TypeScript class. At last, you can configure the agent by setting the locale, timezone, and some of system prompts.

Additionally, if you want to start from the previous A.I. chatbot session, you can accomplish it by assigning the previous prompt histories to the histories property.

Jeongho Nam - https://github.com/samchon

interface INestiaAgentProps {
    config?: INestiaAgentConfig;
    controllers: INestiaAgentController[];
    histories?: (
        | { role: "assistant"
        | "user"; text: string; type: "text" }
        | {
            id: string;
            operations: (
                | {
                    controller: string;
                    function: string;
                    name: string;
                    protocol: "http";
                    reason: string;
                }
                | {
                    controller: string;
                    function: string;
                    name: string;
                    protocol: "class";
                    reason: string;
                }
            )[];
            type: "select";
        }
        | {
            id: string;
            operations: (
                | {
                    controller: string;
                    function: string;
                    name: string;
                    protocol: "http";
                    reason: string;
                }
                | {
                    controller: string;
                    function: string;
                    name: string;
                    protocol: "class";
                    reason: string;
                }
            )[];
            type: "cancel";
        }
        | {
            arguments: object;
            controller: string;
            function: string;
            id: string;
            name: string;
            protocol: "http";
            type: "execute";
            value: {
                body: unknown;
                headers: { [key: string]: string
                | string[] };
                status: number;
            };
        }
        | {
            arguments: object;
            controller: string;
            function: string;
            id: string;
            name: string;
            protocol: "class";
            type: "execute";
            value: any;
        }
        | {
            executions: (
                | {
                    arguments: object;
                    controller: string;
                    function: string;
                    id: string;
                    name: string;
                    protocol: "http";
                    type: "execute";
                    value: {
                        body: unknown;
                        headers: { [key: string]: string
                        | (...)[] };
                        status: number;
                    };
                }
                | {
                    arguments: object;
                    controller: string;
                    function: string;
                    id: string;
                    name: string;
                    protocol: "class";
                    type: "execute";
                    value: any;
                }
            )[];
            text: string;
            type: "describe";
        }
    )[];
    provider: IChatGpt;
}

Properties

Configuration of agent.

Configuration of A.I. chatbot agent including the user's locale, timezone, and some of system prompts. Also, you can affect to the LLM function selecting/calling logic by configuring additional properties.

If you don't configure this property, these values would be default.

controllers: INestiaAgentController[]

Controllers serving functions to call.

histories?: (
    | { role: "assistant"
    | "user"; text: string; type: "text" }
    | {
        id: string;
        operations: (
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "http";
                reason: string;
            }
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "class";
                reason: string;
            }
        )[];
        type: "select";
    }
    | {
        id: string;
        operations: (
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "http";
                reason: string;
            }
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "class";
                reason: string;
            }
        )[];
        type: "cancel";
    }
    | {
        arguments: object;
        controller: string;
        function: string;
        id: string;
        name: string;
        protocol: "http";
        type: "execute";
        value: {
            body: unknown;
            headers: { [key: string]: string
            | string[] };
            status: number;
        };
    }
    | {
        arguments: object;
        controller: string;
        function: string;
        id: string;
        name: string;
        protocol: "class";
        type: "execute";
        value: any;
    }
    | {
        executions: (
            | {
                arguments: object;
                controller: string;
                function: string;
                id: string;
                name: string;
                protocol: "http";
                type: "execute";
                value: {
                    body: unknown;
                    headers: { [key: string]: string
                    | (...)[] };
                    status: number;
                };
            }
            | {
                arguments: object;
                controller: string;
                function: string;
                id: string;
                name: string;
                protocol: "class";
                type: "execute";
                value: any;
            }
        )[];
        text: string;
        type: "describe";
    }
)[]

Prompt histories.

If you're starting the conversation from an existing session, assign the previouis prompt histories to this property.

Type declaration

  • { role: "assistant" | "user"; text: string; type: "text" }
    • role: "assistant" | "user"

      Role of the orator.

    • text: string

      The text content.

    • type: "text"

      Discriminator type.

  • {
        id: string;
        operations: (
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "http";
                reason: string;
            }
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "class";
                reason: string;
            }
        )[];
        type: "select";
    }
    • id: string

      ID of the LLM tool call result.

    • operations: (
          | {
              controller: string;
              function: string;
              name: string;
              protocol: "http";
              reason: string;
          }
          | {
              controller: string;
              function: string;
              name: string;
              protocol: "class";
              reason: string;
          }
      )[]

      Operations that have been selected.

    • type: "select"

      Discriminator type.

  • {
        id: string;
        operations: (
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "http";
                reason: string;
            }
            | {
                controller: string;
                function: string;
                name: string;
                protocol: "class";
                reason: string;
            }
        )[];
        type: "cancel";
    }
    • id: string

      ID of the LLM tool call result.

    • operations: (
          | {
              controller: string;
              function: string;
              name: string;
              protocol: "http";
              reason: string;
          }
          | {
              controller: string;
              function: string;
              name: string;
              protocol: "class";
              reason: string;
          }
      )[]

      Operations that have been cancelled.

    • type: "cancel"

      Discriminator type.

  • {
        arguments: object;
        controller: string;
        function: string;
        id: string;
        name: string;
        protocol: "http";
        type: "execute";
        value: {
            body: unknown;
            headers: { [key: string]: string | string[] };
            status: number;
        };
    }
    • arguments: object

      Arguments of the LLM function calling.

    • controller: string

      Belonged controller of the target function.

    • function: string

      Target function to call.

    • id: string

      ID of the LLM tool call result.

    • name: string

      Identifier name of the function.

      If NestiaAgent has multiple INestiaAgentControllers, the name can be different from target function's name.

    • protocol: "http"

      Protocol discriminator.

    • type: "execute"

      Discriminator type.

    • value: { body: unknown; headers: { [key: string]: string | string[] }; status: number }

      Return value.

      • body: unknown

        Body of the response.

      • headers: { [key: string]: string | string[] }

        Headers of the response.

      • status: number

        Status code of the response.

  • {
        arguments: object;
        controller: string;
        function: string;
        id: string;
        name: string;
        protocol: "class";
        type: "execute";
        value: any;
    }
    • arguments: object

      Arguments of the LLM function calling.

    • controller: string

      Belonged controller of the target function.

    • function: string

      Target function to call.

    • id: string

      ID of the LLM tool call result.

    • name: string

      Identifier name of the function.

      If NestiaAgent has multiple INestiaAgentControllers, the name can be different from target function's name.

    • protocol: "class"

      Protocol discriminator.

    • type: "execute"

      Discriminator type.

    • value: any

      Return value.

  • {
        executions: (
            | {
                arguments: object;
                controller: string;
                function: string;
                id: string;
                name: string;
                protocol: "http";
                type: "execute";
                value: {
                    body: unknown;
                    headers: { [key: string]: string
                    | (...)[] };
                    status: number;
                };
            }
            | {
                arguments: object;
                controller: string;
                function: string;
                id: string;
                name: string;
                protocol: "class";
                type: "execute";
                value: any;
            }
        )[];
        text: string;
        type: "describe";
    }
    • executions: (
          | {
              arguments: object;
              controller: string;
              function: string;
              id: string;
              name: string;
              protocol: "http";
              type: "execute";
              value: {
                  body: unknown;
                  headers: { [key: string]: string
                  | (...)[] };
                  status: number;
              };
          }
          | {
              arguments: object;
              controller: string;
              function: string;
              id: string;
              name: string;
              protocol: "class";
              type: "execute";
              value: any;
          }
      )[]

      Executions of the LLM function calling.

      This prompt describes the return value of them.

    • text: string

      Description text.

    • type: "describe"

      Discriminator type.

provider: IChatGpt

LLM service provider.