ImaGetCha

Shellmiao 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
config 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
modules 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
non_module_old bf6f7825e6 Imagetcha modolar version %!s(int64=2) %!d(string=hai) anos
old bf6f7825e6 Imagetcha modolar version %!s(int64=2) %!d(string=hai) anos
utils 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
.gitignore 30f23c4caf command line interaction %!s(int64=2) %!d(string=hai) anos
README.md 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
main_module.py 7d74212b86 Change name, update readme %!s(int64=2) %!d(string=hai) anos
requirement.txt 58745042ac update readme %!s(int64=2) %!d(string=hai) anos

README.md

ImaGetCha

环境配置

  • 安装python=3.9

  • 安装python依赖库

  pip install -r requirement.txt

使用

python .\main_module.py

配置介绍

通过配置config中的json文件来配置模型结构,下面使用一个例子来介绍如何配置运行结构

组件类型

Chat

需要配置的属性及其作用(带*的为必填):

  1. *class: 标识符,代表完成同类功能,且维护同一输出文件的chat组件

  2. *id: 标识符,每个组件在同一class中的标识符,用于区分同class内不同组件

  3. input: 输入的数据来源,为{key:value}格式。程序会在运行过程中将value路径对应数据读取,并保存为key=json.load(value)的形式,可在后续过程中被调用

使用示例( json文件均可用此种方法读取到程序运行过程中 ):

   "input": {
       "user_input": "user_input.json",
       "input_module_prompt":"prompt/input.json",
       "json_declare":"prompt/json_declare.json"
   }
  1. *prompt: 输入chat模型的template模板,结构固定如下
   //prompt/input.json
   {
       "system_template": "系统消息,可以在其中加入{占位符},必须填写;会被自动填入prompt中",
       "human_template": "用户消息,可以在其中加入{占位符},必须填写;会被自动填入prompt中",
       "其他key": "其他value, 不会被自动当成prompt加入到chat_module中,但可以被当成正常的input读取"
   }
  1. prompt_input: 定义输入到prompt中的占位符变量,为{key:value}格式。遵循python语法

使用示例:

  1. "style":"user_input['style']":user_input.json(在input属性中定义的user_input对应的json文件)中"style"对应的value。在这里定义后即可在template中使用{style}占位符表示
  2. "interact":"interact['class_output_data'][-1]":module_output/Interact_choose_output.json(在input属性中定义的interact对应的json文件)中"class_output_data"对应的数组的最后一个元素
  3. "event":"event['class_output_data'][-4:]":module_output/GPT_event_output.json(在input属性中定义的event对应的json文件)中"class_output_data"对应的数组的最后四个元素组成的数组

  4. *output: 从以下选择填入(目前支持这些,后续再更新)

    1. "{class_output_data}":默认输出到moduleoutput/chat{classname}_output.json中,并且每次在输出时采取覆盖操作,不保留之前的数据;输出得到的json格式与chat_module输出相同
      {chat_module_output}
    
    1. "{class_output_data_append}":默认输出到moduleoutput/chat{classname}_output.json中,并且每次在输出时采取添加操作;输出得到的json格式为
      {
        "class_output_data": [
            ...previous_data,{chat_module_output}
        ]
      }
    
  5. *next_module: 运行此组件完成后的下一个组件,固定格式如下

   "next_module": {
   	"type": "Chat"/"Judgement"/"Interact",
       "class": "classname",
       "id": id
   }

若无下一个组件,则填入None

   "next_module": None