Giter VIP home page Giter VIP logo

promptpan's Introduction

promptpan

Prompt Pan

Prompt Pan 是一个基于 TypeScript 开发的 Prompt 工作流:

flow

所有的工作都基于 LLM,根据输入的 Prompt,依次经过 Agent(用于进行意图识别的代理节点),Chain(针对 Agent 提取的信息进行后续操作的节点),最后输出加工后的数据。

Agent

Agent 适用于进行意图识别的节点,当输入的 Prompt 匹配到对应的 Agent,将被拦截并且由该 Agent 进行加工处理。

class Agent {
  llm: LLM | null;
  constructor(llm: LLM) {
    this.llm = llm;
  }

  extract(prompt: string): any {
    throw new Error('Not implemented');
  }
}

Chain

Chain 持有一个或多个 Pan(封装任务的基本单元),用于进行任务编排。

class Chain {
  private pan: Pan | null;

  constructor(pan?: Pan) {
    this.pan = pan || null;
  }

  async execute(...args: any[]): Promise<any> {
    return this.pan && (await this.pan.call(args[0]));
  }
}

Pan

Pan 是任务执行的最小单元,每个 Pan 实例要实现 call 方法,用于实现特定功能。

abstract class Pan {
  // 调用下游服务
  public abstract call(...args: any[]): any;
}

promptpan's People

Contributors

zhongkai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.