├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── src └── app.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # Used env file 32 | .env 33 | 34 | # vercel 35 | .vercel 36 | 37 | # typescript 38 | *.tsbuildinfo 39 | next-env.d.ts 40 | 41 | StripeAPI.md 42 | NextAPI.md 43 | StraightLine.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Get Started with Langchain JS 2 | a basic node.js template to run langchain.js 3 | 4 | ## How to use this template 5 | 6 | All you need to do is 7 | 1. add your OpenAI API key to the `.env` file `OPENAI_API_KEY=YOUR-KEY` and 8 | 9 | 2. run the app with the following command 10 | ``` 11 | npm install && npm run dev 12 | ``` 13 | 14 | After that, you can edit the `app.ts` file to change the prompt. 15 | 16 | 17 | `app.ts` uses langchain with OpenAI to generate a code snippet, format the response, and save the output (a complete react component) to a file. 18 | 19 | 20 | 21 | ## How this template was built 22 | 23 | 1. install dependencies 24 | 25 | ``` 26 | npm init es6 -y && npm install langchain openai dotenv @types/node 27 | ``` 28 | 2. setup node project 29 | ``` 30 | typescript ts-node 31 | ``` 32 | 33 | ``` 34 | npx tsc --init --rootDir src --outDir ./dist --esModuleInterop --lib ES2020 --target ES2020 --module nodenext --noImplicitAny true 35 | ``` 36 | 37 | 3. Update Package.json 38 | 39 | ``` 40 | "scripts": { 41 | "build": "tsc", 42 | "start": "node ./dist/app.js", 43 | "dev": "ts-node --esm ./src/app.ts" 44 | }, 45 | ``` 46 | 47 | 4. Create app.ts in the src folder. 48 | ``` 49 | mkdir src 50 | echo "console.log('Welcome to the LangChain.js tutorial by LangChainers.')" > src/app.ts 51 | ``` 52 | 53 | 5. boot up 54 | ``` 55 | npm run build 56 | npm run start 57 | ``` 58 | 59 | I followed this [Blog post tutorial](https://langchainers.hashnode.dev/getting-started-with-langchainjs) to setup the initial node environment. 60 | 61 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newlangchain", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "version": "1.0.0", 9 | "license": "AGPL-version-3.0", 10 | "dependencies": { 11 | "@pinecone-database/pinecone": "^0.0.10", 12 | "@types/node": "^18.15.10", 13 | "dotenv": "^16.0.3", 14 | "js-yaml": "^4.1.0", 15 | "langchain": "^0.0.41", 16 | "openai": "^3.2.1", 17 | "pinecone": "^0.1.0", 18 | "serpapi": "^1.1.1", 19 | "typescript": "^5.0.2" 20 | }, 21 | "devDependencies": { 22 | "@types/js-yaml": "^4.0.5", 23 | "ts-node": "^10.9.1" 24 | }, 25 | "engines": { 26 | "node": ">= 14.0.0", 27 | "npm": ">= 6.0.0" 28 | } 29 | }, 30 | "node_modules/@cspotcode/source-map-support": { 31 | "version": "0.8.1", 32 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", 33 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", 34 | "dev": true, 35 | "dependencies": { 36 | "@jridgewell/trace-mapping": "0.3.9" 37 | }, 38 | "engines": { 39 | "node": ">=12" 40 | } 41 | }, 42 | "node_modules/@jridgewell/resolve-uri": { 43 | "version": "3.1.0", 44 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", 45 | "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", 46 | "dev": true, 47 | "engines": { 48 | "node": ">=6.0.0" 49 | } 50 | }, 51 | "node_modules/@jridgewell/sourcemap-codec": { 52 | "version": "1.4.14", 53 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", 54 | "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", 55 | "dev": true 56 | }, 57 | "node_modules/@jridgewell/trace-mapping": { 58 | "version": "0.3.9", 59 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", 60 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", 61 | "dev": true, 62 | "dependencies": { 63 | "@jridgewell/resolve-uri": "^3.0.3", 64 | "@jridgewell/sourcemap-codec": "^1.4.10" 65 | } 66 | }, 67 | "node_modules/@pinecone-database/pinecone": { 68 | "version": "0.0.10", 69 | "resolved": "https://registry.npmjs.org/@pinecone-database/pinecone/-/pinecone-0.0.10.tgz", 70 | "integrity": "sha512-SwfobqOmSQvEkEtw44uc6ZZ9R/aU5bDYkBAX0cGOcSk6wWlm5yiJA+XeZkyMeUsFb1EQaGhbafIy97TDqcnnsw==", 71 | "dependencies": { 72 | "cross-fetch": "^3.1.5" 73 | }, 74 | "engines": { 75 | "node": ">=14.0.0" 76 | } 77 | }, 78 | "node_modules/@tsconfig/node10": { 79 | "version": "1.0.9", 80 | "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", 81 | "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", 82 | "dev": true 83 | }, 84 | "node_modules/@tsconfig/node12": { 85 | "version": "1.0.11", 86 | "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", 87 | "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", 88 | "dev": true 89 | }, 90 | "node_modules/@tsconfig/node14": { 91 | "version": "1.0.3", 92 | "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", 93 | "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", 94 | "dev": true 95 | }, 96 | "node_modules/@tsconfig/node16": { 97 | "version": "1.0.3", 98 | "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", 99 | "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", 100 | "dev": true 101 | }, 102 | "node_modules/@types/js-yaml": { 103 | "version": "4.0.5", 104 | "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", 105 | "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", 106 | "dev": true 107 | }, 108 | "node_modules/@types/node": { 109 | "version": "18.15.10", 110 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.10.tgz", 111 | "integrity": "sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ==" 112 | }, 113 | "node_modules/acorn": { 114 | "version": "8.8.2", 115 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", 116 | "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", 117 | "dev": true, 118 | "bin": { 119 | "acorn": "bin/acorn" 120 | }, 121 | "engines": { 122 | "node": ">=0.4.0" 123 | } 124 | }, 125 | "node_modules/acorn-walk": { 126 | "version": "8.2.0", 127 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", 128 | "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", 129 | "dev": true, 130 | "engines": { 131 | "node": ">=0.4.0" 132 | } 133 | }, 134 | "node_modules/arg": { 135 | "version": "4.1.3", 136 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", 137 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", 138 | "dev": true 139 | }, 140 | "node_modules/argparse": { 141 | "version": "2.0.1", 142 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 143 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" 144 | }, 145 | "node_modules/array-keyed-map": { 146 | "version": "2.1.3", 147 | "resolved": "https://registry.npmjs.org/array-keyed-map/-/array-keyed-map-2.1.3.tgz", 148 | "integrity": "sha512-JIUwuFakO+jHjxyp4YgSiKXSZeC0U+R1jR94bXWBcVlFRBycqXlb+kH9JHxBGcxnVuSqx5bnn0Qz9xtSeKOjiA==" 149 | }, 150 | "node_modules/asynckit": { 151 | "version": "0.4.0", 152 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 153 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" 154 | }, 155 | "node_modules/axios": { 156 | "version": "0.26.1", 157 | "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", 158 | "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", 159 | "dependencies": { 160 | "follow-redirects": "^1.14.8" 161 | } 162 | }, 163 | "node_modules/binary-extensions": { 164 | "version": "2.2.0", 165 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 166 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 167 | "engines": { 168 | "node": ">=8" 169 | } 170 | }, 171 | "node_modules/browser-or-node": { 172 | "version": "2.1.1", 173 | "resolved": "https://registry.npmjs.org/browser-or-node/-/browser-or-node-2.1.1.tgz", 174 | "integrity": "sha512-8CVjaLJGuSKMVTxJ2DpBl5XnlNDiT4cQFeuCJJrvJmts9YrTZDizTX7PjC2s6W4x+MBGZeEY6dGMrF04/6Hgqg==" 175 | }, 176 | "node_modules/busboy": { 177 | "version": "1.6.0", 178 | "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", 179 | "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", 180 | "dependencies": { 181 | "streamsearch": "^1.1.0" 182 | }, 183 | "engines": { 184 | "node": ">=10.16.0" 185 | } 186 | }, 187 | "node_modules/combined-stream": { 188 | "version": "1.0.8", 189 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 190 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 191 | "dependencies": { 192 | "delayed-stream": "~1.0.0" 193 | }, 194 | "engines": { 195 | "node": ">= 0.8" 196 | } 197 | }, 198 | "node_modules/create-require": { 199 | "version": "1.1.1", 200 | "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", 201 | "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", 202 | "dev": true 203 | }, 204 | "node_modules/cross-fetch": { 205 | "version": "3.1.5", 206 | "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", 207 | "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", 208 | "dependencies": { 209 | "node-fetch": "2.6.7" 210 | } 211 | }, 212 | "node_modules/debug": { 213 | "version": "0.8.1", 214 | "resolved": "https://registry.npmjs.org/debug/-/debug-0.8.1.tgz", 215 | "integrity": "sha512-HlXEJm99YsRjLJ8xmuz0Lq8YUwrv7hAJkTEr6/Em3sUlSUNl0UdFA+1SrY4fnykeq1FVkUEUtwRGHs9VvlYbGA==", 216 | "engines": { 217 | "node": "*" 218 | } 219 | }, 220 | "node_modules/delayed-stream": { 221 | "version": "1.0.0", 222 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 223 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", 224 | "engines": { 225 | "node": ">=0.4.0" 226 | } 227 | }, 228 | "node_modules/diff": { 229 | "version": "4.0.2", 230 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 231 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", 232 | "dev": true, 233 | "engines": { 234 | "node": ">=0.3.1" 235 | } 236 | }, 237 | "node_modules/dotenv": { 238 | "version": "16.0.3", 239 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", 240 | "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", 241 | "engines": { 242 | "node": ">=12" 243 | } 244 | }, 245 | "node_modules/eventemitter3": { 246 | "version": "4.0.7", 247 | "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", 248 | "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" 249 | }, 250 | "node_modules/eventsource-parser": { 251 | "version": "0.1.0", 252 | "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-0.1.0.tgz", 253 | "integrity": "sha512-M9QjFtEIkwytUarnx113HGmgtk52LSn3jNAtnWKi3V+b9rqSfQeVdLsaD5AG/O4IrGQwmAAHBIsqbmURPTd2rA==", 254 | "engines": { 255 | "node": ">=14.18" 256 | } 257 | }, 258 | "node_modules/exponential-backoff": { 259 | "version": "3.1.1", 260 | "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", 261 | "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" 262 | }, 263 | "node_modules/expr-eval": { 264 | "version": "2.0.2", 265 | "resolved": "https://registry.npmjs.org/expr-eval/-/expr-eval-2.0.2.tgz", 266 | "integrity": "sha512-4EMSHGOPSwAfBiibw3ndnP0AvjDWLsMvGOvWEZ2F96IGk0bIVdjQisOHxReSkE13mHcfbuCiXw+G4y0zv6N8Eg==" 267 | }, 268 | "node_modules/fast.js": { 269 | "version": "0.0.3", 270 | "resolved": "https://registry.npmjs.org/fast.js/-/fast.js-0.0.3.tgz", 271 | "integrity": "sha512-BhCxo8TngNuFEflJydq06QJKFRnwh/HkFM36qFGibFzwImNr0u5gKtT0HiJGJT/jxBL322BBbc3C4g2+njAUIA==" 272 | }, 273 | "node_modules/follow-redirects": { 274 | "version": "1.15.2", 275 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", 276 | "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", 277 | "funding": [ 278 | { 279 | "type": "individual", 280 | "url": "https://github.com/sponsors/RubenVerborgh" 281 | } 282 | ], 283 | "engines": { 284 | "node": ">=4.0" 285 | }, 286 | "peerDependenciesMeta": { 287 | "debug": { 288 | "optional": true 289 | } 290 | } 291 | }, 292 | "node_modules/form-data": { 293 | "version": "4.0.0", 294 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", 295 | "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", 296 | "dependencies": { 297 | "asynckit": "^0.4.0", 298 | "combined-stream": "^1.0.8", 299 | "mime-types": "^2.1.12" 300 | }, 301 | "engines": { 302 | "node": ">= 6" 303 | } 304 | }, 305 | "node_modules/gpt3-tokenizer": { 306 | "version": "1.1.5", 307 | "resolved": "https://registry.npmjs.org/gpt3-tokenizer/-/gpt3-tokenizer-1.1.5.tgz", 308 | "integrity": "sha512-O9iCL8MqGR0Oe9wTh0YftzIbysypNQmS5a5JG3cB3M4LMYjlAVvNnf8LUzVY9MrI7tj+YLY356uHtO2lLX2HpA==", 309 | "dependencies": { 310 | "array-keyed-map": "^2.1.3" 311 | }, 312 | "engines": { 313 | "node": ">=12" 314 | } 315 | }, 316 | "node_modules/is-binary-path": { 317 | "version": "2.1.0", 318 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 319 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 320 | "dependencies": { 321 | "binary-extensions": "^2.0.0" 322 | }, 323 | "engines": { 324 | "node": ">=8" 325 | } 326 | }, 327 | "node_modules/js-yaml": { 328 | "version": "4.1.0", 329 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 330 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 331 | "dependencies": { 332 | "argparse": "^2.0.1" 333 | }, 334 | "bin": { 335 | "js-yaml": "bin/js-yaml.js" 336 | } 337 | }, 338 | "node_modules/jsonpointer": { 339 | "version": "5.0.1", 340 | "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", 341 | "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", 342 | "engines": { 343 | "node": ">=0.10.0" 344 | } 345 | }, 346 | "node_modules/langchain": { 347 | "version": "0.0.41", 348 | "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.0.41.tgz", 349 | "integrity": "sha512-X7JaexSicy1xfXpJNaQtUSTAjuNmpx0m56ygpMhGZ1ZKhXCXUTIXN4odUMOyP2+h9UnsthjZFrILFNZglghv4g==", 350 | "dependencies": { 351 | "browser-or-node": "^2.1.1", 352 | "eventsource-parser": "^0.1.0", 353 | "exponential-backoff": "^3.1.0", 354 | "expr-eval": "^2.0.2", 355 | "gpt3-tokenizer": "^1.1.5", 356 | "is-binary-path": "^2.1.0", 357 | "jsonpointer": "^5.0.1", 358 | "object-hash": "^3.0.0", 359 | "openai": "^3.2.0", 360 | "p-queue": "^7.3.4", 361 | "uuid": "^9.0.0", 362 | "yaml": "^2.2.1", 363 | "zod": "^3.21.4" 364 | }, 365 | "peerDependencies": { 366 | "@dqbd/tiktoken": "^1.0.2", 367 | "@huggingface/inference": "^1.5.1", 368 | "@pinecone-database/pinecone": "^0.0.10", 369 | "@supabase/supabase-js": "^2.10.0", 370 | "cheerio": "^1.0.0-rc.12", 371 | "chromadb": "^1.3.0", 372 | "cohere-ai": "^5.0.2", 373 | "d3-dsv": "^3.0.1", 374 | "hnswlib-node": "^1.4.2", 375 | "pdf-parse": "^1.1.1", 376 | "puppeteer": "^19.7.2", 377 | "redis": "^4.6.4", 378 | "serpapi": "^1.1.1", 379 | "srt-parser-2": "^1.2.2", 380 | "typeorm": "^0.3.12" 381 | }, 382 | "peerDependenciesMeta": { 383 | "@dqbd/tiktoken": { 384 | "optional": true 385 | }, 386 | "@huggingface/inference": { 387 | "optional": true 388 | }, 389 | "@pinecone-database/pinecone": { 390 | "optional": true 391 | }, 392 | "@supabase/supabase-js": { 393 | "optional": true 394 | }, 395 | "cheerio": { 396 | "optional": true 397 | }, 398 | "chromadb": { 399 | "optional": true 400 | }, 401 | "cohere-ai": { 402 | "optional": true 403 | }, 404 | "d3-dsv": { 405 | "optional": true 406 | }, 407 | "hnswlib-node": { 408 | "optional": true 409 | }, 410 | "pdf-parse": { 411 | "optional": true 412 | }, 413 | "puppeteer": { 414 | "optional": true 415 | }, 416 | "redis": { 417 | "optional": true 418 | }, 419 | "serpapi": { 420 | "optional": true 421 | }, 422 | "srt-parser-2": { 423 | "optional": true 424 | }, 425 | "typeorm": { 426 | "optional": true 427 | } 428 | } 429 | }, 430 | "node_modules/make-error": { 431 | "version": "1.3.6", 432 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 433 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", 434 | "dev": true 435 | }, 436 | "node_modules/mime-db": { 437 | "version": "1.52.0", 438 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 439 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 440 | "engines": { 441 | "node": ">= 0.6" 442 | } 443 | }, 444 | "node_modules/mime-types": { 445 | "version": "2.1.35", 446 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 447 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 448 | "dependencies": { 449 | "mime-db": "1.52.0" 450 | }, 451 | "engines": { 452 | "node": ">= 0.6" 453 | } 454 | }, 455 | "node_modules/minimist": { 456 | "version": "1.2.8", 457 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", 458 | "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", 459 | "funding": { 460 | "url": "https://github.com/sponsors/ljharb" 461 | } 462 | }, 463 | "node_modules/node-fetch": { 464 | "version": "2.6.7", 465 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 466 | "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", 467 | "dependencies": { 468 | "whatwg-url": "^5.0.0" 469 | }, 470 | "engines": { 471 | "node": "4.x || >=6.0.0" 472 | }, 473 | "peerDependencies": { 474 | "encoding": "^0.1.0" 475 | }, 476 | "peerDependenciesMeta": { 477 | "encoding": { 478 | "optional": true 479 | } 480 | } 481 | }, 482 | "node_modules/object-hash": { 483 | "version": "3.0.0", 484 | "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", 485 | "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", 486 | "engines": { 487 | "node": ">= 6" 488 | } 489 | }, 490 | "node_modules/openai": { 491 | "version": "3.2.1", 492 | "resolved": "https://registry.npmjs.org/openai/-/openai-3.2.1.tgz", 493 | "integrity": "sha512-762C9BNlJPbjjlWZi4WYK9iM2tAVAv0uUp1UmI34vb0CN5T2mjB/qM6RYBmNKMh/dN9fC+bxqPwWJZUTWW052A==", 494 | "dependencies": { 495 | "axios": "^0.26.0", 496 | "form-data": "^4.0.0" 497 | } 498 | }, 499 | "node_modules/p-queue": { 500 | "version": "7.3.4", 501 | "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.3.4.tgz", 502 | "integrity": "sha512-esox8CWt0j9EZECFvkFl2WNPat8LN4t7WWeXq73D9ha0V96qPRufApZi4ZhPwXAln1uVVal429HVVKPa2X0yQg==", 503 | "dependencies": { 504 | "eventemitter3": "^4.0.7", 505 | "p-timeout": "^5.0.2" 506 | }, 507 | "engines": { 508 | "node": ">=12" 509 | }, 510 | "funding": { 511 | "url": "https://github.com/sponsors/sindresorhus" 512 | } 513 | }, 514 | "node_modules/p-timeout": { 515 | "version": "5.1.0", 516 | "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", 517 | "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", 518 | "engines": { 519 | "node": ">=12" 520 | }, 521 | "funding": { 522 | "url": "https://github.com/sponsors/sindresorhus" 523 | } 524 | }, 525 | "node_modules/pinecone": { 526 | "version": "0.1.0", 527 | "resolved": "https://registry.npmjs.org/pinecone/-/pinecone-0.1.0.tgz", 528 | "integrity": "sha512-iKu0Vs4ijfueG9fRoOfJ6Ko0Yb/y/XK2kmNXz9WgG8LuDwneXWcmPQqhm7nUvAxFroQQdGSmM2zM33d4l/4UfQ==", 529 | "dependencies": { 530 | "acorn": "~0.5.0", 531 | "debug": "^0.8.1", 532 | "fast.js": "0.0.3", 533 | "minimist": "^1.1.0" 534 | }, 535 | "bin": { 536 | "pinecone": "bin/pinecone" 537 | } 538 | }, 539 | "node_modules/pinecone/node_modules/acorn": { 540 | "version": "0.5.0", 541 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-0.5.0.tgz", 542 | "integrity": "sha512-C+F0F79vOrEG1cNTBTKDJma7LSiWl6AkWJd1lqt6W784YLQSD+bFBLAbbLOXDHSr7+vSZvy5cX3CTMsCgocfxQ==", 543 | "bin": { 544 | "acorn": "bin/acorn" 545 | }, 546 | "engines": { 547 | "node": ">=0.4.0" 548 | } 549 | }, 550 | "node_modules/serpapi": { 551 | "version": "1.1.1", 552 | "resolved": "https://registry.npmjs.org/serpapi/-/serpapi-1.1.1.tgz", 553 | "integrity": "sha512-t5Bqu/6VMJ9naX8K+qCgUStpZOaNQFvIM4AudhMJLS6sqQT/EHaYrhGidDZHVx8QvcEdY6y1wNlxizOCtvJtUQ==", 554 | "dependencies": { 555 | "undici": "^5.12.0" 556 | } 557 | }, 558 | "node_modules/streamsearch": { 559 | "version": "1.1.0", 560 | "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", 561 | "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", 562 | "engines": { 563 | "node": ">=10.0.0" 564 | } 565 | }, 566 | "node_modules/tr46": { 567 | "version": "0.0.3", 568 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 569 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 570 | }, 571 | "node_modules/ts-node": { 572 | "version": "10.9.1", 573 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", 574 | "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", 575 | "dev": true, 576 | "dependencies": { 577 | "@cspotcode/source-map-support": "^0.8.0", 578 | "@tsconfig/node10": "^1.0.7", 579 | "@tsconfig/node12": "^1.0.7", 580 | "@tsconfig/node14": "^1.0.0", 581 | "@tsconfig/node16": "^1.0.2", 582 | "acorn": "^8.4.1", 583 | "acorn-walk": "^8.1.1", 584 | "arg": "^4.1.0", 585 | "create-require": "^1.1.0", 586 | "diff": "^4.0.1", 587 | "make-error": "^1.1.1", 588 | "v8-compile-cache-lib": "^3.0.1", 589 | "yn": "3.1.1" 590 | }, 591 | "bin": { 592 | "ts-node": "dist/bin.js", 593 | "ts-node-cwd": "dist/bin-cwd.js", 594 | "ts-node-esm": "dist/bin-esm.js", 595 | "ts-node-script": "dist/bin-script.js", 596 | "ts-node-transpile-only": "dist/bin-transpile.js", 597 | "ts-script": "dist/bin-script-deprecated.js" 598 | }, 599 | "peerDependencies": { 600 | "@swc/core": ">=1.2.50", 601 | "@swc/wasm": ">=1.2.50", 602 | "@types/node": "*", 603 | "typescript": ">=2.7" 604 | }, 605 | "peerDependenciesMeta": { 606 | "@swc/core": { 607 | "optional": true 608 | }, 609 | "@swc/wasm": { 610 | "optional": true 611 | } 612 | } 613 | }, 614 | "node_modules/typescript": { 615 | "version": "5.0.2", 616 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", 617 | "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", 618 | "bin": { 619 | "tsc": "bin/tsc", 620 | "tsserver": "bin/tsserver" 621 | }, 622 | "engines": { 623 | "node": ">=12.20" 624 | } 625 | }, 626 | "node_modules/undici": { 627 | "version": "5.21.0", 628 | "resolved": "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz", 629 | "integrity": "sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA==", 630 | "dependencies": { 631 | "busboy": "^1.6.0" 632 | }, 633 | "engines": { 634 | "node": ">=12.18" 635 | } 636 | }, 637 | "node_modules/uuid": { 638 | "version": "9.0.0", 639 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", 640 | "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", 641 | "bin": { 642 | "uuid": "dist/bin/uuid" 643 | } 644 | }, 645 | "node_modules/v8-compile-cache-lib": { 646 | "version": "3.0.1", 647 | "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", 648 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", 649 | "dev": true 650 | }, 651 | "node_modules/webidl-conversions": { 652 | "version": "3.0.1", 653 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 654 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 655 | }, 656 | "node_modules/whatwg-url": { 657 | "version": "5.0.0", 658 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 659 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 660 | "dependencies": { 661 | "tr46": "~0.0.3", 662 | "webidl-conversions": "^3.0.0" 663 | } 664 | }, 665 | "node_modules/yaml": { 666 | "version": "2.2.1", 667 | "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", 668 | "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", 669 | "engines": { 670 | "node": ">= 14" 671 | } 672 | }, 673 | "node_modules/yn": { 674 | "version": "3.1.1", 675 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", 676 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", 677 | "dev": true, 678 | "engines": { 679 | "node": ">=6" 680 | } 681 | }, 682 | "node_modules/zod": { 683 | "version": "3.21.4", 684 | "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", 685 | "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", 686 | "funding": { 687 | "url": "https://github.com/sponsors/colinhacks" 688 | } 689 | } 690 | } 691 | } 692 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "license": "AGPL-version-3.0", 8 | "private": false, 9 | "engines": { 10 | "node": ">= 14.0.0", 11 | "npm": ">= 6.0.0" 12 | }, 13 | "homepage": "", 14 | "repository": { 15 | "type": "git", 16 | "url": "" 17 | }, 18 | "bugs": "", 19 | "keywords": [], 20 | "author": { 21 | "name": "", 22 | "email": "", 23 | "url": "" 24 | }, 25 | "contributors": [], 26 | "scripts": { 27 | "build": "tsc", 28 | "start": "node ./dist/app.js", 29 | "dev": "ts-node --esm ./src/app.ts" 30 | }, 31 | "dependencies": { 32 | "@pinecone-database/pinecone": "^0.0.10", 33 | "@types/node": "^18.15.10", 34 | "dotenv": "^16.0.3", 35 | "js-yaml": "^4.1.0", 36 | "langchain": "^0.0.41", 37 | "openai": "^3.2.1", 38 | "pinecone": "^0.1.0", 39 | "serpapi": "^1.1.1", 40 | "typescript": "^5.0.2" 41 | }, 42 | "devDependencies": { 43 | "@types/js-yaml": "^4.0.5", 44 | "ts-node": "^10.9.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | import { OpenAI, PromptTemplate } from "langchain"; 2 | import { StructuredOutputParser } from "langchain/output_parsers"; 3 | import fs from 'fs'; 4 | import { ChatOpenAI } from "langchain/chat_models"; 5 | import { HumanChatMessage, SystemChatMessage } from "langchain/schema"; 6 | 7 | //Load environment variables (populate process.env from .env file) 8 | import * as dotenv from "dotenv"; 9 | dotenv.config(); 10 | 11 | 12 | const chat = new ChatOpenAI({ temperature: 0 }); 13 | 14 | export const run = async () => { 15 | const response = await chat.call([ 16 | new HumanChatMessage( 17 | "give me a nextjs component that renders an h1 tag with the text Starmorph'" 18 | ), 19 | ]); 20 | 21 | try { 22 | await fs.promises.writeFile('response.txt', JSON.stringify(response, null, 2)); 23 | console.log('File saved successfully.'); 24 | } catch (err) { 25 | console.error('Error writing file:', err); 26 | } 27 | 28 | 29 | const removeEscapedCharacters = (str: string) => { 30 | return str.replace(/\\n/g, '\n'); 31 | }; 32 | 33 | const processFile = async () => { 34 | try { 35 | // Read the JSON file 36 | const fileContent = await fs.promises.readFile('response.txt', 'utf8'); 37 | 38 | // Parse the JSON content 39 | const jsonData = JSON.parse(fileContent); 40 | 41 | // Extract the 'text' property and remove escaped characters 42 | const text = removeEscapedCharacters(jsonData.text); 43 | 44 | // Save the result to a new file 45 | await fs.promises.writeFile('output.txt', text); 46 | console.log('File processed successfully.'); 47 | } catch (err) { 48 | console.error('Error processing file:', err); 49 | } 50 | }; 51 | 52 | processFile(); 53 | 54 | 55 | console.log(response); 56 | }; 57 | run(); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | "lib": ["es2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "nodenext", /* Specify what module code is generated. */ 29 | "rootDir": "src", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 39 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 40 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 41 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 42 | // "resolveJsonModule": true, /* Enable importing .json files. */ 43 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 44 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 45 | 46 | /* JavaScript Support */ 47 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 48 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 49 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 50 | 51 | /* Emit */ 52 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 53 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 54 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 55 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 56 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 57 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 58 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 59 | // "removeComments": true, /* Disable emitting comments. */ 60 | // "noEmit": true, /* Disable emitting files from a compilation. */ 61 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 62 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 63 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 64 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 65 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 66 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 67 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 68 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 69 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 70 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 71 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 72 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 73 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 74 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 75 | 76 | /* Interop Constraints */ 77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 79 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 80 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 81 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 82 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 83 | 84 | /* Type Checking */ 85 | "strict": true, /* Enable all strict type-checking options. */ 86 | "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 87 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 88 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 89 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 90 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 91 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 92 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 93 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 94 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 95 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 96 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 97 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 98 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 99 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 100 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 101 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 102 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 103 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 104 | 105 | /* Completeness */ 106 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 107 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 108 | } 109 | } 110 | --------------------------------------------------------------------------------