1. Preface
Create TypeScript classes, and transform them into AI chatbots.
From now on, every TypeScript developer can become an AI developer.
TypeScript developers, let us become AI developers with @agentica
.
- Github Repository: https://github.com/wrtnlabs/agentica
- Guide Documents: https://wrtnlabs.io/agentica
import { Agentica } from "@agentica/core";
import OpenAI from "openai";
import typia from "typia";
const agent = new Agentica({
vendor: {
model: "gpt-4o-mini",
api: new OpenAI({ apiKey: "********" }),
},
controllers: [
{
protocol: "class",
application: typia.llm.application<BbsArticleService, "chatgpt">(),
execute: new BbsArticleService(),
},
],
});
await agent.conversate("I want to write an article.");
2. Agentica Framework
@agentica
is a framework specialized in LLM function calling.
You can provide functions through TypeScript class types. If you create the FileSystem
class below and integrate it with @agentica
, it becomes a filesystem chatbot. You can manage your filesystem through conversational text in the chatbot.
If you simultaneously provide multiple TypeScript classes such as GoogleScholarService
, NaverNewsService
, and NotionService
, your AI agent can write a Notion document by analyzing scholarly papers and news articles. When you ask the agent to analyze recent Korean economic trends, comment on them, organize related papers, and write them in Notion, the AI agent will execute these tasks.
Simply define your TypeScript classes, and you can create any AI agent you desire.
import fs from "fs";
export class FileSystem {
public __dirname(): string {
return __dirname;
}
public readdir(input: {
path: string;
options?:
| {
encoding: "utf-8";
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
}
| "utf-8"
| null;
}): Promise<string[]> {
return fs.promises.readdir(input.path, input.options);
}
public readFile(input: { path: string }): Promise<string> {
return fs.promises.readFile(input.path, "utf8");
}
public writeFileSync(input: {
file: string;
data: string;
}): Promise<void> {
return fs.promises.writeFile(input.file, input.data);
}
}
3. Enterprise Demonstration
Some may wonder: Don't the BbsArticleService
or FileSystem
classes have only a few functions? Is this merely a toy project that functions well in limited scenarios? Is it possible to create an enterprise-level chatbot with @agentica
?
The answer is yes, it is indeed possible to create enterprise-grade chatbots.
Here is an enterprise-level shopping mall chatbot comprising 289 API functions. It supports most features of standard e-commerce platforms, and as demonstrated, it operates without issues.
For reference, @agentica
can also acquire functions from Swagger/OpenAPI documentation. The demonstration below originates from a @samchon/shopping-backend
.
import { Agentica } from "@agentica/core";
import { HttpLlm, OpenApi } from "@samchon/openapi";
import typia from "typia";
const agent = new Agentica({
model: "chatgpt",
vendor: {
api: new OpenAI({ apiKey: "*****" }),
model: "gpt-4o-mini",
},
controllers: [
{
protocol: "http",
name: "shopping",
application: HttpLlm.application({
model: "chatgpt",
document: await fetch(
"https://shopping-be.wrtn.ai/editor/swagger.json",
).then((r) => r.json()),
}),
connection: {
host: "https://shopping-be.wrtn.ai",
headers: {
Authorization: "Bearer *****",
},
},
},
{
protocol: "class",
name: "counselor",
application: typia.llm.application<ShoppingCounselor, "chatgpt">(),
execute: new ShoppingCounselor(),
},
{
protocol: "class",
name: "policy",
application: typia.llm.application<ShoppingPolicy, "chatgpt">(),
execute: new ShoppingPolicy(),
},
{
protocol: "class",
name: "rag",
application: typia.llm.application<ShoppingSearchRag, "chatgpt">(),
execute: new ShoppingSearchRag(),
},
],
});
await agent.conversate("I want to buy a MacBook Pro");
4. Principles
If you are not familiar with AI, you may wonder how @agentica
can accomplish everything through functions.
Alternatively, if you are an expert in AI agent development, you might have a different question. Traditional agent development centers around agent workflow graphs, so how does @agentica
utilize LLM function calling to achieve similar capabilities?
Visit our framework homepage or read my previous article to understand the key principles of @agentica
. In these resources, you will learn about new AI development paradigms: "Compiler-Driven Development" and "Document-Driven Development."
- Github Repository: https://github.com/wrtnlabs/agentica
- Guide Documents: https://wrtnlabs.io/agentica
5. Next Article
https://dev.to/samchon/every-backend-developer-is-a-great-ai-developer-338m
Every backend developer is also AI developer.
Considering the nature of work that backend developers do, they are actually better positioned for AI agent development than traditional AI/ML engineers.
Let's take swagger.json
file to the @agentica
, so that make an AI chatbot executing the API functions during the conversation.
Top comments (4)
Traffic is growing so much, and many people are bookmarking, but no one is commenting, so it's boring.
Do you have any articles you'd like to read at the next time?
@agentica
frameworkThis article is good, we can also use transformers (hugging face) and use any pretrained models(eg: BERT, GPT) based on the use case.
You may like our roadmap - wrtnlabs.io/agentica/docs/roadmap/...
우와 신기합니다. 항상 좋은글 감사합니다!