# Create generation **POST /generations** 根据提供的内容、文件或提示创建一个生成任务,生成考试题目。 在创建生成任务时,需要通过 `creation_type` 来声明任务类型,通过 `question_rules` 来指定生成题目的种类和数量。 ### creation_type: - `knowledge_base` 通过资料生成题目 - `question_bank` 格式化本地题库 - `oneline` 无资料情况下,根据需求描述生成题目 如果你已经拥有一个本地题库,它们可能是 Word、Excel 或 PDF 文件,你可以先上传文件,然后创建一个 `question_bank` 类型的任务。 ```json { file: 'file-xxxxxx', creation_type: 'question_bank' } ``` 如果你有一份文档资料,它们可能是 Word、PDF 或 PPT 文件,你可以先上传文件,然后创建一个 `knowledge_base` 类型的任务。 ```json { file: 'file-xxxxxx', creation_type: 'knowledge_base', question_rules: [{ type: 'single_choice', count: 10 }] } ``` 如果你没有任何资料,你可以直接创建一个 `oneline` 类型的任务。 ```json { prompt: '帮我生成一套反诈知识的试卷', creation_type: 'oneline', question_rules: [{ type: 'single_choice', count: 10 }] } ``` ### question_rule: - `type` 题目类型,可选值: - `single_choice` 单选题 - `multiple_choice` 多选题 - `true_or_false` 判断题 - `multiple_blank` 填空题 - `short_answer` 简答题 - `count` 题目数量,合计生成的题目数量最大为 100。 ## Servers - Production: https://v5.jinshuju.net/exam/api (Production) ## Authentication methods - Bearer auth ## Parameters ### Body: application/json (object) - **prompt** (string) - **creation_type** (string) - **question_rules** (array[object]) Maximum sum(count) is `100`. - **metadata** (object | null) ## Responses ### 201 generation created #### Body: application/json (object) - **id** (string) - **object** (string) - **created_at** (string(date-time)) - **finished_at** (string(date-time) | null) - **status** (string) ### 400 generation not created [Powered by Bump.sh](https://bump.sh)