Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module @nestia/agent, A.I. chatbot performing LLM function calling to the backend server #1173

Merged
merged 8 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ packages/*/*.tgz
packages/*/docs
package-lock.json
pnpm-lock.yaml
*.log
*.log
.env
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/express": "^4.17.17",
"@types/node": "^20.1.4",
"@types/physical-cpu-count": "^2.0.0",
"rimraf": "^5.0.1",
"rimraf": "^6.0.1",
"ts-node": "^10.9.1",
"ts-patch": "^3.3.0",
"typescript": "~5.7.2"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^22.10.1",
"prettier": "^3.2.4",
"rimraf": "^5.0.1",
"rimraf": "^6.0.1",
"sloc": "^0.3.0"
}
}
28 changes: 28 additions & 0 deletions packages/agent/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
root: true,
plugins: ["@typescript-eslint", "deprecation"],
extends: ["plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "test/tsconfig.json"],
},
overrides: [
{
files: ["src/**/*.ts", "test/**/*.ts"],
rules: {
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-empty-object-type": "off",
},
},
],
};
87 changes: 87 additions & 0 deletions packages/agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Nestia
![Nestia Logo](https://nestia.io/logo.png)

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
[![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)
[![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)

Nestia is a set of helper libraries for NestJS, supporting below features:

- `@nestia/core`:
- Super-fast/easy decorators
- Advanced WebSocket routes
- `@nestia/sdk`:
- Swagger generator evolved than ever
- SDK library generator for clients
- Mockup Simulator for client applications
- Automatic E2E test functions generator
- `@nestia/e2e`: Test program utilizing e2e test functions
- `@nestia/benchmark`: Benchmark program using e2e test functions
- `@nestia/migrate`: OpenAPI generator from Swagger to NestJS/SDK
- `@nestia/editor`: Swagger-UI with Online TypeScript Editor
- `nestia`: Just CLI (command line interface) tool

> [!NOTE]
>
> - **Only one line** required, with pure TypeScript type
> - Enhance performance **30x** up
> - Runtime validator is **20,000x faster** than `class-validator`
> - JSON serialization is **200x faster** than `class-transformer`
> - Software Development Kit
> - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
> - Mockup simulator means embedded backend simulator in the SDK
> - similar with [msw](https://mswjs.io/), but fully automated

![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)

> Left is NestJS server code, and right is client (frontend) code utilizing SDK




## Sponsors and Backers
Thanks for your support.

Your donation would encourage `nestia` development.

[![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)




## Guide Documents
Check out the document in the [website](https://nestia.io/docs/):

### 🏠 Home
- [Introduction](https://nestia.io/docs/)
- [Setup](https://nestia.io/docs/setup/)
- [Pure TypeScript](https://nestia.io/docs/pure)

### 📖 Features
- Core Library
- [WebSocketRoute](https://nestia.io/docs/core/WebSocketRoute)
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
- [TypedQuery](https://nestia.io/docs/core/TypedQuery/)
- [TypedHeaders](https://nestia.io/docs/core/TypedHeaders/)
- [TypedException](https://nestia.io/docs/core/TypedException/)
- Generators
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
- [Software Development Kit](https://nestia.io/docs/sdk/sdk/)
- [E2E Functions](https://nestia.io/docs/sdk/e2e/)
- [Mockup Simulator](https://nestia.io/docs/sdk/simulator/)
- E2E Testing
- [Why E2E Test?](https://nestia.io/docs/e2e/why/)
- [Test Program Development](https://nestia.io/docs/e2e/development/)
- [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
- [Swagger to NestJS](https://nestia.io/docs/migrate/)
- [TypeScript Swagger Editor](https://nestia.io/docs/editor/)

### 🔗 Appendix
- [API Documents](https://nestia.io/api)
- [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
- [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
68 changes: 68 additions & 0 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@nestia/agent",
"version": "0.1.0",
"description": "Super A.I. Chatbot agent by Swagger Document",
"main": "lib/index.js",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
"scripts": {
"prepare": "ts-patch install && typia patch",
"build": "npm run build:main && npm run build:test",
"build:main": "rimraf lib && tsc && rollup -c",
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
"dev": "npm run build:test -- --watch"
},
"repository": {
"type": "git",
"url": "https://github.com/samchon/nestia"
},
"keywords": [
"openai",
"chatgpt",
"anthropic",
"claude",
"ai",
"chatbot",
"nestia",
"swagger",
"openapi"
],
"author": "Jeongho Nam",
"license": "MIT",
"bugs": {
"url": "https://github.com/samchon/nestia/issues"
},
"homepage": "https://nestia.io",
"files": [
"README.md",
"LICENSE",
"package.json",
"lib",
"src"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@nestia/e2e": "^0.7.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.1",
"@samchon/shopping-api": "^0.11.0",
"@types/node": "^22.10.5",
"@types/uuid": "^10.0.0",
"chalk": "4.1.2",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
"rimraf": "^6.0.1",
"rollup": "^4.29.1",
"ts-patch": "^3.3.0",
"tstl": "^3.0.0",
"typescript": "~5.7.2",
"typescript-transform-paths": "^3.5.3"
},
"dependencies": {
"@samchon/openapi": "^2.3.2",
"openai": "^4.77.0",
"typia": "^7.5.1",
"uuid": "^11.0.4"
}
}
29 changes: 29 additions & 0 deletions packages/agent/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const typescript = require("@rollup/plugin-typescript");
const terser = require("@rollup/plugin-terser");

module.exports = {
input: "./src/index.ts",
output: {
dir: "lib",
format: "esm",
entryFileNames: "[name].mjs",
sourcemap: true,
},
plugins: [
typescript({
tsconfig: "tsconfig.json",
module: "ES2020",
target: "ES2020",
}),
terser({
format: {
comments: "some",
beautify: true,
ecma: "2020",
},
compress: false,
mangle: false,
module: true,
}),
],
};
Loading
Loading