LLMParser 开源项目使用教程

LLMParser 开源项目使用教程

llmparserClassify and extract structured data with LLMs项目地址:https://gitcode.com/gh_mirrors/ll/llmparser

1. 项目的目录结构及介绍

LLMParser 项目的目录结构如下:

llmparser/
├── src/
│   ├── main.ts
│   ├── config/
│   │   ├── default.ts
│   │   ├── production.ts
│   ├── utils/
│   │   ├── parser.ts
│   │   ├── helper.ts
├── test/
│   ├── main.test.ts
│   ├── config.test.ts
├── .eslintignore
├── .eslintrc.js
├── .gitattributes
├── .gitignore
├── .prettierrc
├── LICENSE
├── README.md
├── jest.config.js
├── package-lock.json
├── package.json
├── tsconfig.build.json
├── tsconfig.json

目录结构介绍

  • src/: 项目的主要源代码目录。
    • main.ts: 项目的入口文件。
    • config/: 配置文件目录。
      • default.ts: 默认配置文件。
      • production.ts: 生产环境配置文件。
    • utils/: 工具函数目录。
      • parser.ts: 解析器相关函数。
      • helper.ts: 辅助函数。
  • test/: 测试文件目录。
    • main.test.ts: 入口文件的测试。
    • config.test.ts: 配置文件的测试。
  • .eslintignore: ESLint 忽略配置。
  • .eslintrc.js: ESLint 配置文件。
  • .gitattributes: Git 属性配置。
  • .gitignore: Git 忽略配置。
  • .prettierrc: Prettier 格式化配置。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • jest.config.js: Jest 测试配置。
  • package-lock.json: npm 依赖锁定文件。
  • package.json: 项目依赖和脚本配置。
  • tsconfig.build.json: TypeScript 构建配置。
  • tsconfig.json: TypeScript 配置。

2. 项目的启动文件介绍

项目的启动文件是 src/main.ts。该文件是整个项目的入口点,负责初始化配置、加载必要的模块,并启动应用。

// src/main.ts
import { LLMParser } from './utils/parser';
import config from './config/default';

async function start() {
  const parser = new LLMParser(config);
  await parser.init();
  console.log('LLMParser started successfully.');
}

start();

3. 项目的配置文件介绍

项目的配置文件位于 src/config/ 目录下。

默认配置文件

src/config/default.ts 是默认配置文件,包含了应用的基本配置。

// src/config/default.ts
export default {
  apiKey: process.env.OPENAI_API_KEY,
  categories: [
    {
      name: "MSA",
      description: "Master service agreement",
    },
    {
      name: "NDA",
      description: "Non disclosure agreement",
      fields: [
        {
          name: "effective_date",
          description: "effective date or start date",
          type: "string",
        },
        {
          name: "company",
          description: "name of the company",
          type: "string",
        },
        {
          name: "counterparty",
          description: "name of the counterparty",
          type: "string",
        },
      ],
    },
  ],
};

生产环境配置文件

src/config/production.ts 是生产环境配置文件,可以根据需要进行调整。

// src/config/production.ts
import defaultConfig from './default';

export default {
  ...defaultConfig,
  apiKey: process.env.PROD_OPENAI_API_KEY,
};

以上是 LLMParser 开源项目的目录结构、启动文件和配置文件的详细介绍。希望这份教程能帮助你更好地理解和使用该项目。

llmparserClassify and extract structured data with LLMs项目地址:https://gitcode.com/gh_mirrors/ll/llmparser

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

何柳新Dalton

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值