Package Exports
- simple-prompt-executer
- simple-prompt-executer/lib/esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-prompt-executer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Prompt を実行してパースするだけ
使い方サンプル
npm install simple-prompt-executer
や yarn add simple-prompt-executer
でパッケージを入れれます
Node ESM
import { PromptExecuter } from "simple-prompt-executer";
const prompt = {
prompt: `以下の文章から4択クイズを考えてください。`,
exampleDescription: "パンをテーマにクイズを考えた例です。",
response: {
question: {
example: "パンはパンでも食べられないパンはなんだ",
description: "クイズの問題",
},
selection: {
example: "フライパン, AI, パンダ, パン粉",
description: "選択肢",
},
answer: {
example: "パン",
description: "答え",
},
},
};
const executer = new PromptExecuter({ openAiApiKey: "sk-xxxx" });
const result = await executer.execute(prompt);
// ^result = {
// question: "クリスマスに隠かくれている3つのものはなーんだ?",
// selection: "クリ、リス、マス,トナカイ,シカ,奈良",
// answer: "クリ、リス、マス"
// }
// 型もついてるのでこれはエラーになります
result.notExistProperty;
Deno
import { PromptExecuter } from "npm:simple-prompt-executer";
const prompt = {
prompt: `以下の文章から4択クイズを考えてください。`,
exampleDescription: "パンをテーマにクイズを考えた例です。",
response: {
question: {
example: "パンはパンでも食べられないパンはなんだ",
description: "クイズの問題",
},
selection: {
example: "フライパン, AI, パンダ, パン粉",
description: "選択肢",
},
answer: {
example: "パン",
description: "答え",
},
},
};
const executer = new PromptExecuter({ openAiApiKey: "sk-xxxx" });
const result = await executer.execute(prompt);
// ^result = {
// question: "クリスマスに隠かくれている3つのものはなーんだ?",
// selection: "クリ、リス、マス,トナカイ,シカ,奈良",
// answer: "クリ、リス、マス"
// }
// 型もついてるのでこれはエラーになります
result.notExistProperty;
LLM は自分で決めたい
import { makePromptString, parsePrompt } from "simple-prompt-executer";
const prompt = {
prompt: `以下の文章から4択クイズを考えてください。`,
exampleDescription: "パンをテーマにクイズを考えた例です。",
response: {
question: {
example: "パンはパンでも食べられないパンはなんだ",
description: "クイズの問題",
},
selection: {
example: "フライパン, AI, パンダ, パン粉",
description: "選択肢",
},
answer: {
example: "パン",
description: "答え",
},
},
};
const stringPrompt = makePromptString(prompt);
const llmOutput = `Use any llm here`;
const result = parsePrompt(prompt, llmOutput);
// ^result = {
// question: "クリスマスに隠かくれている3つのものはなーんだ?",
// selection: "クリ、リス、マス,トナカイ,シカ,奈良",
// answer: "クリ、リス、マス"
// }
// 型もついてるのでこれはエラーになります
result.notExistProperty;
Lisence
This project is licensed under the MIT License, see the LICENSE.txt file for details