I'm also utilizing the LLM with JSON schema like you in the same reason.
By the way, I am using typia library instead of zod.
I understand why you've selected the zod library. It has huge ecosystem and loved by many TypeScript developers.
However, I prefer to using the pure TypeScript type without any extra schema definition. Also, when many schema types be defined, zod makes IDE extremely slow with enormous resource consumption, so that taking benefit of auto-completion by TypeScript types becomes impossible. Furthermore, I write description comments in as much detail as possible and use them actively. This is because this description is as important to the quality of LLM as the type or attribute name.
To use pure TypeScript type
To avoid IDE performance problem
To actively utilize description comments
In such reason, may I publish similar repo with you, and also link to your youtube video?
import typia, { tags } from "typia";
typia.json.application<[IBbsArticle]>();
/**
* Article entity.
*
* `IBbsArticle* is a super-type entity of all kinds of articles in the current
* backend system, literally shaping individual articles of the bulletin board.
*
* And, as you can see, the elements that must inevitably exist in the article,
* such as the `title` or the `body`, do not exist in the `IBbsArticle`, but exist
* in the subsidiary entity, {@link IBbsArticle.ISnapshot}, as a 1: N relationship,
* which is because a new snapshot record is published every time the article is
* modified.
*
* The reason why a new snapshot record is published every time the article is
* modified is to preserve the evidence. Due to the nature of e-community, there
* is always a threat of dispute among the participants. And it can happen that
* disputes arise through articles or {@link IBbsArticleComment comments}, and to
* prevent such things as modifying existing articles to manipulate the situation,
* the article is designed in this structure.
*
* In other words, to keep evidence, and prevent fraud.
*
* @author Samchon
*/
interface IBbsArticle {
/**
* Primary Key.
*/
id: string & tags.Format<"uuid">;
/**
* Writer of article.
*/
writer: string;
/**
* List of snapshot contents.
*
* It is created for the first time when an article is created, and is
* accumulated every time the article is modified.
*/
snapshots: IBbsArticle.ISnapshot[] & tags.MinItems<1>;
/**
* Creation time of article.
*/
created_at: string & tags.Format<"date-time">;
}
I'm also utilizing the LLM with JSON schema like you in the same reason.
By the way, I am using
typia
library instead ofzod
.I understand why you've selected the
zod
library. It has huge ecosystem and loved by many TypeScript developers.However, I prefer to using the pure TypeScript type without any extra schema definition. Also, when many schema types be defined,
zod
makes IDE extremely slow with enormous resource consumption, so that taking benefit of auto-completion by TypeScript types becomes impossible. Furthermore, I write description comments in as much detail as possible and use them actively. This is because this description is as important to the quality of LLM as the type or attribute name.In such reason, may I publish similar repo with you, and also link to your youtube video?
https://github.com/instructor-ai/instructor-js/assets/13158709/c00d3f8e-f709-41a9-9b42-d007f1e60928