Preface
- BBS A.I. Chatbot Application: https://nestia.io/chat/bbs
- Source Codes:
- Related Repositories:
The above demonstration shows BBS chatbot built with typia.llm.applicationOfValidate<App, Model>
function.
As you can see, in the BBS A.I. chatbot application, the user can do everything defined in the TypeScript class just by conversation texts. Writing and reading articles, user can do these things just by chatting texts.
Just by delivering the TypeScript class type utilizing the typia.llm.applicationOfValidate<Class, Model>()
function, Super A.I. chatbot performing the LLM (Large Language Model) function calling is automatically composed. The Super A.I. chatbot will select proper functions defined in the TypeScript class type by analyzing conversation texts with the user. And then Super A.I. chatbot requests the user to write arguments for the selected functions by conversation text, and actually calls the function with the arguments. This is the key concept of the Super A.I. chatbot of typia
and nestia
A.I. chatbot.
In other words, every TypeScript classes can be conversed to the A.I. chatbot. In the new A.I. era, you don't need to develop GUI (Graphical User Interface) application more. Just prepare TypeScript class with enough documentations, and let the A.I. chatbot to do the rest. The A.I. chatbot can replace your new GUI application, and it can be more efficient and user-friendly than the traditional GUI applications.
The typia.llm.appliction<Class, Model>()
function.
import typia, { ILlmApplicationOfValidate } from "typia";
import { BbsArticleService } from "./BbsArticleService";
const application: ILlmApplicationOfValidate<"chatgpt"> =
typia.llm.applicationOfValidate<BbsArticleService, "chatgpt">();
If you call typia.llm.application<Class, Model>()
function with the target TypeScript class, LLM function calling schema would be returned, and it would be utilized for the Super A.I. chatbot composition.
This is the secret of this article subject, building Super A.I. chatbot which performs LLM function calling from a TypeScript class type. typia
is a framework which can analyze TypeScript type in the compilation level, and transform it to a specific code. When you call the typia.llm.applicationOfValidate<BbsArticleService, "chatgpt">()
function, typia
analyzes the BbsArticleServie
class type in the compilation level, and transform it to the LLM function calling schema.
Anyway, as the Super A.I. chatbot of this article starts from composing the LLM function calling schema, the typia.llm.application<Class, Model>()
function is the most important in here article subject. Please don't forget it.
typia
also provides runtime validation feature liketypia.assert<T>()
function. And with the ability of compilation level type analysis and source code transformation, its validation is exact and faster than any other runtime validator libraries. For example, when compare withclass-validator
,typia
is about 20,000x faster.Measured on Intel i5-1235U, Surface Pro 9
Application Development
import { NestiaAgent } from "@nestia/agent";
import { NestiaChatApplication } from "@nestia/chat";
import OpenAI from "openai";
import typia from "typia";
import { BbsArticleService } from "./BbsArticleService";
export const BbsChatApplication = (props: BbsChatApplication.IProps) => {
const service: BbsArticleService = new BbsArticleService();
const agent: NestiaAgent = new NestiaAgent({
provider: {
type: "chatgpt",
api: new OpenAI({
apiKey: props.apiKey,
dangerouslyAllowBrowser: true,
}),
model: props.model ?? "gpt-4o-mini",
},
controllers: [
{
protocol: "class",
name: "bbs",
application: typia.llm.applicationOfValidate<
BbsArticleService,
"chatgpt"
>(),
execute: async (props) => {
return (service as any)[props.function.name](props.arguments);
},
},
],
config: {
locale: props.locale,
timezone: props.timezone,
},
});
return <NestiaChatApplication agent={agent} />;
};
export namespace BbsChatApplication {
export interface IProps {
apiKey: string;
model?: OpenAI.ChatModel;
locale?: string;
timezone?: string;
}
}
If you've prepared a TypeScript class, developing Super A.I. chatbot is very easy. Just install @nestia/agent
, @nestia/chat
, and render the <NestiaChatApplication />
component the typia.llm.applicationOfValidate<BbsArticleService, "chatgpt">()
function calling.
Then you can start conversation with your TypeScript class type. Have a good time with your TypeScript class instance, and feel the new A.I. era.
Do you understand? You don't need to dedicate frontend application development like before. A.I. chatbot will do the rest.
Backend Development
- Shopping A.I. Chatbot Application: https://nestia.io/chat/shopping
- Shopping Backend Repository: https://github.com/samchon/shopping-backend
- Shopping Swagger Document (
@nestia/editor
): https://nestia.io/editor/?url=...
You also can make the Super A.I. chatbot by Swagger document too.
Until now, we've leared how to build an A.I. chatbot with the TypeScript class type. By the way, @nestia/agent
and @nestia/chat
supports another way to building the A.I. chatbot. It is the Swagger document. If you have a backend server and the backend server has a Swagger document, you also can create the super A.I. chatbot.
I'll handle about this subject detaily at the next article.
By the way, the most important thing is that, every backend servers providing Swagger documents also can be conversed to the A.I. chatbot too. Therefore, in the new A.I. era, you don't need to develop GUI (Graphical User Interface) application more. Just develop TypeScript class or backend server, and let the A.I. chatbot to do the rest. The A.I. chatbot can replace the GUI application development, and it can be more efficient and user-friendly than the traditional GUI applications.
Make your own A.I. chatbot
Above @nestia/agent
and @nestia/chat
libraries are just for testing and demonstration. I’ve made them to prove a conncept that every TypeScript classes can be conversed with the A.I. chatbot, and typia
/ nestia
are especially efficient for the A.I. chatbot development purpose.
However, @nestia/agent
support only OpenAI, and has not optimized for specific purpose. As it has not been optimized without any RAG (Retrieval Augmented Generation) models, it may consume a lot of LLM cost than what you may expected. Therefore, use the @nestia/agent
for studying the A.I. chatbot development, or just demonstrating your TypeScript class before the production development.
- Source Codes:
-
@nestia/agent
: https://github.com/samchon/nestia/tree/master/packages/agent -
@nestia/chat
: https://github.com/samchon/nestia/tree/master/packages/chat
-
Top comments (0)