diff --git a/package.json b/package.json index 8813ec9..c22896b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@luckrnx09/abook", - "version": "1.0.1", + "version": "1.0.2", "description": "

⚡ abook⚡

An AI powered command-line tool for generating any books from scratch

", "bin": { "abook": "dist/index.js" @@ -58,8 +58,8 @@ }, "dependencies": { "@inquirer/prompts": "^5.0.4", - "@langchain/core": "^0.2.0", - "@langchain/openai": "^0.0.33", + "@langchain/core": "^0.2.13", + "@langchain/openai": "^0.2.1", "commander": "^12.1.0", "console-table-printer": "^2.12.0", "dotenv-cli": "^7.4.2", diff --git a/src/bot/generation/task/prompt/writer.ts b/src/bot/generation/task/prompt/writer.ts index f88592c..bc62303 100644 --- a/src/bot/generation/task/prompt/writer.ts +++ b/src/bot/generation/task/prompt/writer.ts @@ -13,12 +13,14 @@ You're a meticulous book writer. You can write articles based on the information - Requirements: ${book.prompt?.length ? book.prompt : 'N/A'} ### Skill 2: Output Article Iteratively -- Conceptualize and make sure that the full article should have 2,000 to 10,000 words. +- Conceptualize and make sure that the full article should have TWO THOUSAND to TEN THOUSAND words. - Write rationally, use precise, concise, logical and refer more examples. Don't use vague expressions, and do not stretch and over-elaborate. - Iteratively write until complete: - Send me a special text "DONE" in English if you've completed writing the full article. - Coherently write the next paragraph if I send you "Continue writing" in English. - - Each paragraph should stick to the title but that doesn't mean it always starts with text from the title. You need to write vivid, appropriate paragraph text in context. + - Continuing from what already written in vivid, appropriate paragraph text. + - Use the Pyramid Principle to organize each paragraph without omitting and repeating content. + - If you don't have a good idea for some paragraph, please don't feel free to write about it, and leave a placeholder and replace TOPIC in format \`\` to prompt the writer to manually fill in whatever is here. - Don't iterate more than 5 times. - Every response both the special text and article paragraph should enclosed within the tags. - Never write any headings in markdown. diff --git a/src/bot/idea/prompt/book-schemer.ts b/src/bot/idea/prompt/book-schemer.ts index fee2e4a..8c980e6 100644 --- a/src/bot/idea/prompt/book-schemer.ts +++ b/src/bot/idea/prompt/book-schemer.ts @@ -10,8 +10,8 @@ You are a book schemer who can skillfully utilize the given book idea to craft a ### Skill 2: Create a book outline - Based on the interpreted information, craft a logical and compelling book outline. -- Following the MECE principle, enhance the outline by supplementing with additional insightful points. -- Ensure that the book outline is in \`OutlineSchema\` format and the outline must contain at least *12 chapters*, each of chapter should contain *3 to 6 articles*. +- Following the Pyramid Principle, enhance the outline by supplementing with additional insightful points. +- Ensure that the book outline is in \`OutlineSchema\` format and the outline must contain at least TWELVE chapters, each of chapter should contain THREE to SIX articles. - No serial number required for chapter and article titles. ### Skill 2: Learn the \`OutlineSchema\` diff --git a/yarn.lock b/yarn.lock index da150a9..e16ed6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -367,7 +367,7 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@langchain/core@>0.1.0 <0.3.0", "@langchain/core@>0.1.56 <0.3.0", "@langchain/core@^0.2.0", "@langchain/core@~0.2.0": +"@langchain/core@>0.1.0 <0.3.0", "@langchain/core@>0.1.56 <0.3.0", "@langchain/core@~0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.2.0.tgz#19c6374a5ad80daf8e14cb58582bc988109a1403" integrity sha512-UbCJUp9eh2JXd9AW/vhPbTgtZoMgTqJgSan5Wf/EP27X8JM65lWdCOpJW+gHyBXvabbyrZz3/EGaptTUL5gutw== @@ -385,7 +385,36 @@ zod "^3.22.4" zod-to-json-schema "^3.22.3" -"@langchain/openai@^0.0.33", "@langchain/openai@~0.0.28": +"@langchain/core@>=0.2.8 <0.3.0", "@langchain/core@^0.2.13": + version "0.2.13" + resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.2.13.tgz#5bf1fb66b1ea436ef7b6450309c6a9f3a8c767bb" + integrity sha512-inMx0o4bvv2/wgztHQs013gKkN51cli7XwbVSn/6PVRz7FEZK2dKi4807gZaez2NMiHTuxjwDUMrliWZTtXWNw== + dependencies: + ansi-styles "^5.0.0" + camelcase "6" + decamelize "1.2.0" + js-tiktoken "^1.0.12" + langsmith "~0.1.30" + ml-distance "^4.0.0" + mustache "^4.2.0" + p-queue "^6.6.2" + p-retry "4" + uuid "^9.0.0" + zod "^3.22.4" + zod-to-json-schema "^3.22.3" + +"@langchain/openai@^0.2.1": + version "0.2.1" + resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.2.1.tgz#2c0c2cb6bd7839d8ce342c97099c6e35f2dde40d" + integrity sha512-Ti3C6ZIUPaueIPAfMljMnLu3GSGNq5KmrlHeWkIbrLShOBlzj4xj7mRfR73oWgAC0qivfxdkfbB0e+WCY+oRJw== + dependencies: + "@langchain/core" ">=0.2.8 <0.3.0" + js-tiktoken "^1.0.12" + openai "^4.49.1" + zod "^3.22.4" + zod-to-json-schema "^3.22.3" + +"@langchain/openai@~0.0.28": version "0.0.33" resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.0.33.tgz#af88d815ff0095018c879d3a1a5a32b2795b5c69" integrity sha512-hTBo9y9bHtFvMT5ySBW7TrmKhLSA91iNahigeqAFBVrLmBDz+6rzzLFc1mpq6JEAR3fZKdaUXqso3nB23jIpTw== @@ -1847,6 +1876,17 @@ langchainhub@~0.0.8: resolved "https://registry.yarnpkg.com/langchainhub/-/langchainhub-0.0.10.tgz#7579440a3255d67571b7046f3910593c5664f064" integrity sha512-mOVso7TGTMSlvTTUR1b4zUIMtu8zgie/pcwRm1SeooWwuHYMQovoNXjT6gEjvWEZ6cjt4gVH+1lu2tp1/phyIQ== +langsmith@~0.1.30: + version "0.1.36" + resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.1.36.tgz#5f21b9c6bcd4ea9c0e943f83e304a53e5232297d" + integrity sha512-D5hhkFl31uxFdffx0lA6pin0lt8Pv2dpHFZYpSgEzvQ26PQ/Y/tnniQ+aCNokIXuLhMa7uqLtb6tfwjfiZXgdg== + dependencies: + "@types/uuid" "^9.0.1" + commander "^10.0.1" + p-queue "^6.6.2" + p-retry "4" + uuid "^9.0.0" + langsmith@~0.1.7: version "0.1.25" resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.1.25.tgz#3d06b6fc62abb1a6fc16540d40ddb48bd795f128" @@ -2211,6 +2251,20 @@ openai@^4.41.1: node-fetch "^2.6.7" web-streams-polyfill "^3.2.1" +openai@^4.49.1: + version "4.52.3" + resolved "https://registry.yarnpkg.com/openai/-/openai-4.52.3.tgz#3c6459dfd65e2bf9671729f25879a5b4224dca70" + integrity sha512-IyQLYKGYoEEkUCEm2frPzwHDJ3Ym663KtivnY6pWCzuoi6/HgSIMMxpcuTRS81GH6tiULPYGmTxIvzXdmPIWOw== + dependencies: + "@types/node" "^18.11.18" + "@types/node-fetch" "^2.6.4" + abort-controller "^3.0.0" + agentkeepalive "^4.2.1" + form-data-encoder "1.7.2" + formdata-node "^4.3.2" + node-fetch "^2.6.7" + web-streams-polyfill "^3.2.1" + openapi-types@^12.1.3: version "12.1.3" resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3"