diff --git a/package.json b/package.json index feda870..0338282 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.691.0", "@faker-js/faker": "^7.6.0", - "@google/generative-ai": "^0.21.0", + "openai": "^4.0.0", "@nestjs/mapped-types": "^2.0.6", "ansi-colors": "^4.1.3", "axios": "^1.7.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5122a56..8be3db9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,15 +14,6 @@ importers: '@faker-js/faker': specifier: ^7.6.0 version: 7.6.0 - '@google/generative-ai': - specifier: ^0.21.0 - version: 0.21.0 - '@langchain/core': - specifier: ^0.3.0 - version: 0.3.79(openai@5.12.2(zod@3.25.76)) - '@langchain/google-genai': - specifier: ^0.1.0 - version: 0.1.12(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(zod@3.25.76) '@nestjs/mapped-types': specifier: ^2.0.6 version: 2.0.6(@nestjs/common@10.4.8(class-transformer@0.5.1)(class-validator@0.14.1)(reflect-metadata@0.2.2)(rxjs@7.8.1))(class-transformer@0.5.1)(class-validator@0.14.1)(reflect-metadata@0.2.2) @@ -86,9 +77,6 @@ importers: jsonwebtoken: specifier: ^9.0.2 version: 9.0.2 - langchain: - specifier: ^0.3.0 - version: 0.3.36(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(@langchain/google-genai@0.1.12(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(zod@3.25.76))(axios@1.7.7)(handlebars@4.7.8)(openai@5.12.2(zod@3.25.76)) mongoose: specifier: ^8.8.1 version: 8.8.1(@aws-sdk/credential-providers@3.691.0(@aws-sdk/client-sso-oidc@3.691.0(@aws-sdk/client-sts@3.691.0)))(socks@2.8.3) @@ -110,6 +98,9 @@ importers: nodemailer: specifier: ^6.9.16 version: 6.9.16 + openai: + specifier: ^4.0.0 + version: 4.104.0(zod@3.25.76) passport: specifier: ^0.7.0 version: 0.7.0 @@ -417,9 +408,6 @@ packages: resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} engines: {node: '>=6.9.0'} - '@cfworker/json-schema@4.1.1': - resolution: {integrity: sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==} - '@colors/colors@1.6.0': resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} engines: {node: '>=0.1.90'} @@ -666,14 +654,6 @@ packages: resolution: {integrity: sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==} engines: {node: '>=14.0.0', npm: '>=6.0.0'} - '@google/generative-ai@0.21.0': - resolution: {integrity: sha512-7XhUbtnlkSEZK15kN3t+tzIMxsbKm/dSkKBFalj+20NvPKe1kBY7mR2P7vuijEn+f06z5+A8bVGKO0v39cr6Wg==} - engines: {node: '>=18.0.0'} - - '@google/generative-ai@0.24.1': - resolution: {integrity: sha512-MqO+MLfM6kjxcKoy0p1wRzG3b4ZZXtPI+z2IE26UogS2Cm/XHO+7gGRBh6gcJsOiIVoH93UwKvW4HdgiOZCy9Q==} - engines: {node: '>=18.0.0'} - '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} @@ -715,28 +695,6 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@langchain/core@0.3.79': - resolution: {integrity: sha512-ZLAs5YMM5N2UXN3kExMglltJrKKoW7hs3KMZFlXUnD7a5DFKBYxPFMeXA4rT+uvTxuJRZPCYX0JKI5BhyAWx4A==} - engines: {node: '>=18'} - - '@langchain/google-genai@0.1.12': - resolution: {integrity: sha512-0Ea0E2g63ejCuormVxbuoyJQ5BYN53i2/fb6WP8bMKzyh+y43R13V8JqOtr3e/GmgNyv3ou/VeaZjx7KAvu/0g==} - engines: {node: '>=18'} - peerDependencies: - '@langchain/core': '>=0.3.17 <0.4.0' - - '@langchain/openai@0.6.16': - resolution: {integrity: sha512-v9INBOjE0w6ZrUE7kP9UkRyNsV7daH7aPeSOsPEJ35044UI3udPHwNduQ8VmaOUsD26OvSdg1b1GDhrqWLMaRw==} - engines: {node: '>=18'} - peerDependencies: - '@langchain/core': '>=0.3.68 <0.4.0' - - '@langchain/textsplitters@0.1.0': - resolution: {integrity: sha512-djI4uw9rlkAb5iMhtLED+xJebDdAG935AdP4eRTB02R7OB/act55Bj9wsskhZsvuyQRpO4O1wQOp85s6T6GWmw==} - engines: {node: '>=18'} - peerDependencies: - '@langchain/core': '>=0.2.21 <0.4.0' - '@lukeed/csprng@1.1.0': resolution: {integrity: sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==} engines: {node: '>=8'} @@ -1095,6 +1053,12 @@ packages: '@types/multer@1.4.12': resolution: {integrity: sha512-pQ2hoqvXiJt2FP9WQVLPRO+AmiIm/ZYkavPlIQnx282u4ZrVdztx0pkh3jjpQt0Kz+YI0YhSG264y08UJKoUQg==} + '@types/node-fetch@2.6.13': + resolution: {integrity: sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==} + + '@types/node@18.19.130': + resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} + '@types/node@20.17.6': resolution: {integrity: sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==} @@ -1116,9 +1080,6 @@ packages: '@types/range-parser@1.2.7': resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} - '@types/retry@0.12.0': - resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==} - '@types/send@0.17.4': resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} @@ -1131,9 +1092,6 @@ packages: '@types/triple-beam@1.3.5': resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==} - '@types/uuid@10.0.0': - resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} - '@types/validator@13.12.2': resolution: {integrity: sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==} @@ -1213,6 +1171,10 @@ packages: abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + abort-controller@3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} + accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -1235,6 +1197,10 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} + agentkeepalive@4.6.0: + resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} + engines: {node: '>= 8.0.0'} + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -1265,10 +1231,6 @@ packages: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} - ansi-styles@5.2.0: - resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} - engines: {node: '>=10'} - ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} @@ -1410,6 +1372,10 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -1418,10 +1384,6 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - camelcase@6.3.0: - resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} - engines: {node: '>=10'} - chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -1545,9 +1507,6 @@ packages: console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} - console-table-printer@2.15.0: - resolution: {integrity: sha512-SrhBq4hYVjLCkBVOWaTzceJalvn5K1Zq5aQA6wXC/cYjI3frKWNPEMK3sZsJfNNQApvCQmgBcc13ZKmFj8qExw==} - content-disposition@0.5.4: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} @@ -1672,10 +1631,6 @@ packages: supports-color: optional: true - decamelize@1.2.0: - resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} - engines: {node: '>=0.10.0'} - deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -1733,6 +1688,10 @@ packages: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -1789,6 +1748,10 @@ packages: resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} engines: {node: '>= 0.4'} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} @@ -1797,10 +1760,18 @@ packages: resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} engines: {node: '>= 0.4'} + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + es-set-tostringtag@2.0.3: resolution: {integrity: sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==} engines: {node: '>= 0.4'} + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} @@ -1920,8 +1891,9 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} - eventemitter3@4.0.7: - resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + event-target-shim@5.0.1: + resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} + engines: {node: '>=6'} eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} @@ -2034,10 +2006,21 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} + form-data-encoder@1.7.2: + resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} + form-data@4.0.1: resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} + form-data@4.0.5: + resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} + engines: {node: '>= 6'} + + formdata-node@4.4.1: + resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} + engines: {node: '>= 12.20'} + forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -2085,6 +2068,14 @@ packages: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} @@ -2133,6 +2124,10 @@ packages: gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} @@ -2163,6 +2158,10 @@ packages: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + has-tostringtag@1.0.2: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} @@ -2192,6 +2191,9 @@ packages: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + husky@9.1.6: resolution: {integrity: sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==} engines: {node: '>=18'} @@ -2404,9 +2406,6 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true - js-tiktoken@1.0.21: - resolution: {integrity: sha512-biOj/6M5qdgx5TKjDnFT1ymSpM5tbd3ylwDtrQvFQSu0Z7bBYko2dF+W/aUkXUPuk6IVpRxk/3Q2sHOzGlS36g==} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -2440,10 +2439,6 @@ packages: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} engines: {'0': node >= 0.2.0} - jsonpointer@5.0.1: - resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==} - engines: {node: '>=0.10.0'} - jsonwebtoken@9.0.2: resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} engines: {node: '>=12', npm: '>=6'} @@ -2468,81 +2463,6 @@ packages: kuler@2.0.0: resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==} - langchain@0.3.36: - resolution: {integrity: sha512-PqC19KChFF0QlTtYDFgfEbIg+SCnCXox29G8tY62QWfj9bOW7ew2kgWmPw5qoHLOTKOdQPvXET20/1Pdq8vAtQ==} - engines: {node: '>=18'} - peerDependencies: - '@langchain/anthropic': '*' - '@langchain/aws': '*' - '@langchain/cerebras': '*' - '@langchain/cohere': '*' - '@langchain/core': '>=0.3.58 <0.4.0' - '@langchain/deepseek': '*' - '@langchain/google-genai': '*' - '@langchain/google-vertexai': '*' - '@langchain/google-vertexai-web': '*' - '@langchain/groq': '*' - '@langchain/mistralai': '*' - '@langchain/ollama': '*' - '@langchain/xai': '*' - axios: '*' - cheerio: '*' - handlebars: ^4.7.8 - peggy: ^3.0.2 - typeorm: '*' - peerDependenciesMeta: - '@langchain/anthropic': - optional: true - '@langchain/aws': - optional: true - '@langchain/cerebras': - optional: true - '@langchain/cohere': - optional: true - '@langchain/deepseek': - optional: true - '@langchain/google-genai': - optional: true - '@langchain/google-vertexai': - optional: true - '@langchain/google-vertexai-web': - optional: true - '@langchain/groq': - optional: true - '@langchain/mistralai': - optional: true - '@langchain/ollama': - optional: true - '@langchain/xai': - optional: true - axios: - optional: true - cheerio: - optional: true - handlebars: - optional: true - peggy: - optional: true - typeorm: - optional: true - - langsmith@0.3.82: - resolution: {integrity: sha512-RTcxtRm0zp2lV+pMesMW7EZSsIlqN7OmR2F6sZ/sOFQwmcLVl+VErMPV4VkX4Sycs4/EIAFT5hpr36EqiHoikQ==} - peerDependencies: - '@opentelemetry/api': '*' - '@opentelemetry/exporter-trace-otlp-proto': '*' - '@opentelemetry/sdk-trace-base': '*' - openai: '*' - peerDependenciesMeta: - '@opentelemetry/api': - optional: true - '@opentelemetry/exporter-trace-otlp-proto': - optional: true - '@opentelemetry/sdk-trace-base': - optional: true - openai: - optional: true - levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -2655,6 +2575,10 @@ packages: make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} @@ -2844,10 +2768,6 @@ packages: resolution: {integrity: sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==} engines: {node: '>= 6.0.0'} - mustache@4.2.0: - resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} - hasBin: true - mute-stream@0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} @@ -2875,6 +2795,11 @@ packages: resolution: {integrity: sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==} engines: {node: '>= 8.0.0'} + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + deprecated: Use your platform's native DOMException instead + node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -2972,8 +2897,8 @@ packages: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} - openai@5.12.2: - resolution: {integrity: sha512-xqzHHQch5Tws5PcKR2xsZGX9xtch+JQFz5zb14dGqlshmmDAFBFEWmeIpf7wVqWV+w7Emj7jRgkNJakyKE0tYQ==} + openai@4.104.0: + resolution: {integrity: sha512-p99EFNsA/yX6UhVO93f5kJsDRLAg+CTA2RBqdHK4RtK8u5IJw32Hyb2dTGKbnnFmnuoBv5r7Z2CURI9sGZpSuA==} hasBin: true peerDependencies: ws: ^8.18.0 @@ -2984,9 +2909,6 @@ packages: zod: optional: true - openapi-types@12.1.3: - resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} - optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -2999,10 +2921,6 @@ packages: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} - p-finally@1.0.0: - resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} - engines: {node: '>=4'} - p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -3019,18 +2937,6 @@ packages: resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - p-queue@6.6.2: - resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} - engines: {node: '>=8'} - - p-retry@4.6.2: - resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} - engines: {node: '>=8'} - - p-timeout@3.2.0: - resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==} - engines: {node: '>=8'} - package-json-from-dist@1.0.1: resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} @@ -3208,10 +3114,6 @@ packages: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} - retry@0.13.1: - resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} - engines: {node: '>= 4'} - reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -3323,9 +3225,6 @@ packages: resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} engines: {node: '>=10'} - simple-wcswidth@1.1.2: - resolution: {integrity: sha512-j7piyCjAeTDSjzTSQ7DokZtMNwNlEAyxqSZeCS+CXH7fJ4jx3FuJ/mTW3mE+6JLs4VJBbcll0Kjn+KXI5t21Iw==} - slice-ansi@5.0.0: resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} engines: {node: '>=12'} @@ -3612,6 +3511,9 @@ packages: undefsafe@2.0.5: resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} @@ -3633,10 +3535,6 @@ packages: resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} engines: {node: '>= 0.4.0'} - uuid@10.0.0: - resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} - hasBin: true - uuid@9.0.1: resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} hasBin: true @@ -3655,6 +3553,10 @@ packages: wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + web-streams-polyfill@4.0.0-beta.3: + resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==} + engines: {node: '>= 14'} + webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} @@ -3770,11 +3672,6 @@ packages: resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} engines: {node: '>=12.20'} - zod-to-json-schema@3.25.0: - resolution: {integrity: sha512-HvWtU2UG41LALjajJrML6uQejQhNJx+JBO9IflpSja4R03iNWfKXrj6W2h7ljuLyc1nKS+9yDyL/9tD1U/yBnQ==} - peerDependencies: - zod: ^3.25 || ^4 - zod@3.25.76: resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} @@ -4388,8 +4285,6 @@ snapshots: '@babel/helper-validator-identifier@7.25.9': {} - '@cfworker/json-schema@4.1.1': {} - '@colors/colors@1.6.0': {} '@commitlint/cli@19.5.0(@types/node@20.17.6)(typescript@5.6.3)': @@ -4609,10 +4504,6 @@ snapshots: '@faker-js/faker@7.6.0': {} - '@google/generative-ai@0.21.0': {} - - '@google/generative-ai@0.24.1': {} - '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -4658,48 +4549,6 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76))': - dependencies: - '@cfworker/json-schema': 4.1.1 - ansi-styles: 5.2.0 - camelcase: 6.3.0 - decamelize: 1.2.0 - js-tiktoken: 1.0.21 - langsmith: 0.3.82(openai@5.12.2(zod@3.25.76)) - mustache: 4.2.0 - p-queue: 6.6.2 - p-retry: 4.6.2 - uuid: 10.0.0 - zod: 3.25.76 - zod-to-json-schema: 3.25.0(zod@3.25.76) - transitivePeerDependencies: - - '@opentelemetry/api' - - '@opentelemetry/exporter-trace-otlp-proto' - - '@opentelemetry/sdk-trace-base' - - openai - - '@langchain/google-genai@0.1.12(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(zod@3.25.76)': - dependencies: - '@google/generative-ai': 0.24.1 - '@langchain/core': 0.3.79(openai@5.12.2(zod@3.25.76)) - zod-to-json-schema: 3.25.0(zod@3.25.76) - transitivePeerDependencies: - - zod - - '@langchain/openai@0.6.16(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))': - dependencies: - '@langchain/core': 0.3.79(openai@5.12.2(zod@3.25.76)) - js-tiktoken: 1.0.21 - openai: 5.12.2(zod@3.25.76) - zod: 3.25.76 - transitivePeerDependencies: - - ws - - '@langchain/textsplitters@0.1.0(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))': - dependencies: - '@langchain/core': 0.3.79(openai@5.12.2(zod@3.25.76)) - js-tiktoken: 1.0.21 - '@lukeed/csprng@1.1.0': {} '@mapbox/node-pre-gyp@1.0.11': @@ -5193,6 +5042,15 @@ snapshots: dependencies: '@types/express': 4.17.21 + '@types/node-fetch@2.6.13': + dependencies: + '@types/node': 20.17.6 + form-data: 4.0.5 + + '@types/node@18.19.130': + dependencies: + undici-types: 5.26.5 + '@types/node@20.17.6': dependencies: undici-types: 6.19.8 @@ -5219,8 +5077,6 @@ snapshots: '@types/range-parser@1.2.7': {} - '@types/retry@0.12.0': {} - '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 @@ -5239,8 +5095,6 @@ snapshots: '@types/triple-beam@1.3.5': {} - '@types/uuid@10.0.0': {} - '@types/validator@13.12.2': {} '@types/webidl-conversions@7.0.3': {} @@ -5344,6 +5198,10 @@ snapshots: abbrev@1.1.1: {} + abort-controller@3.0.0: + dependencies: + event-target-shim: 5.0.1 + accepts@1.3.8: dependencies: mime-types: 2.1.35 @@ -5365,6 +5223,10 @@ snapshots: transitivePeerDependencies: - supports-color + agentkeepalive@4.6.0: + dependencies: + humanize-ms: 1.2.1 + ajv@6.12.6: dependencies: fast-deep-equal: 3.1.3 @@ -5397,8 +5259,6 @@ snapshots: dependencies: color-convert: 2.0.1 - ansi-styles@5.2.0: {} - ansi-styles@6.2.1: {} anymatch@3.1.3: @@ -5583,6 +5443,11 @@ snapshots: bytes@3.1.2: {} + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + call-bind@1.0.7: dependencies: es-define-property: 1.0.0 @@ -5593,8 +5458,6 @@ snapshots: callsites@3.1.0: {} - camelcase@6.3.0: {} - chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -5726,10 +5589,6 @@ snapshots: console-control-strings@1.1.0: {} - console-table-printer@2.15.0: - dependencies: - simple-wcswidth: 1.1.2 - content-disposition@0.5.4: dependencies: safe-buffer: 5.2.1 @@ -5841,8 +5700,6 @@ snapshots: optionalDependencies: supports-color: 5.5.0 - decamelize@1.2.0: {} - deep-is@0.1.4: {} defaults@1.0.4: @@ -5889,6 +5746,12 @@ snapshots: dotenv@16.4.5: {} + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + eastasianwidth@0.2.0: {} ecdsa-sig-formatter@1.0.11: @@ -5989,18 +5852,31 @@ snapshots: dependencies: get-intrinsic: 1.2.4 + es-define-property@1.0.1: {} + es-errors@1.3.0: {} es-object-atoms@1.0.0: dependencies: es-errors: 1.3.0 + es-object-atoms@1.1.1: + dependencies: + es-errors: 1.3.0 + es-set-tostringtag@2.0.3: dependencies: get-intrinsic: 1.2.4 has-tostringtag: 1.0.2 hasown: 2.0.2 + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + es-shim-unscopables@1.0.2: dependencies: hasown: 2.0.2 @@ -6176,7 +6052,7 @@ snapshots: etag@1.8.1: {} - eventemitter3@4.0.7: {} + event-target-shim@5.0.1: {} eventemitter3@5.0.1: {} @@ -6330,12 +6206,27 @@ snapshots: cross-spawn: 7.0.5 signal-exit: 4.1.0 + form-data-encoder@1.7.2: {} + form-data@4.0.1: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + form-data@4.0.5: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.2 + mime-types: 2.1.35 + + formdata-node@4.4.1: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 4.0.0-beta.3 + forwarded@0.2.0: {} fresh@0.5.2: {} @@ -6384,6 +6275,24 @@ snapshots: has-symbols: 1.0.3 hasown: 2.0.2 + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.1 + get-stream@8.0.1: {} get-symbol-description@1.0.2: @@ -6445,6 +6354,8 @@ snapshots: dependencies: get-intrinsic: 1.2.4 + gopd@1.2.0: {} + graphemer@1.4.0: {} handlebars@4.7.8: @@ -6470,6 +6381,8 @@ snapshots: has-symbols@1.0.3: {} + has-symbols@1.1.0: {} + has-tostringtag@1.0.2: dependencies: has-symbols: 1.0.3 @@ -6501,6 +6414,10 @@ snapshots: human-signals@5.0.0: {} + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + husky@9.1.6: {} iconv-lite@0.4.24: @@ -6711,10 +6628,6 @@ snapshots: jiti@1.21.6: {} - js-tiktoken@1.0.21: - dependencies: - base64-js: 1.5.1 - js-tokens@4.0.0: {} js-yaml@4.1.0: @@ -6739,8 +6652,6 @@ snapshots: jsonparse@1.3.1: {} - jsonpointer@5.0.1: {} - jsonwebtoken@9.0.2: dependencies: jws: 3.2.2 @@ -6775,42 +6686,6 @@ snapshots: kuler@2.0.0: {} - langchain@0.3.36(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(@langchain/google-genai@0.1.12(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(zod@3.25.76))(axios@1.7.7)(handlebars@4.7.8)(openai@5.12.2(zod@3.25.76)): - dependencies: - '@langchain/core': 0.3.79(openai@5.12.2(zod@3.25.76)) - '@langchain/openai': 0.6.16(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76))) - '@langchain/textsplitters': 0.1.0(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76))) - js-tiktoken: 1.0.21 - js-yaml: 4.1.0 - jsonpointer: 5.0.1 - langsmith: 0.3.82(openai@5.12.2(zod@3.25.76)) - openapi-types: 12.1.3 - p-retry: 4.6.2 - uuid: 10.0.0 - yaml: 2.5.1 - zod: 3.25.76 - optionalDependencies: - '@langchain/google-genai': 0.1.12(@langchain/core@0.3.79(openai@5.12.2(zod@3.25.76)))(zod@3.25.76) - axios: 1.7.7 - handlebars: 4.7.8 - transitivePeerDependencies: - - '@opentelemetry/api' - - '@opentelemetry/exporter-trace-otlp-proto' - - '@opentelemetry/sdk-trace-base' - - openai - - ws - - langsmith@0.3.82(openai@5.12.2(zod@3.25.76)): - dependencies: - '@types/uuid': 10.0.0 - chalk: 4.1.2 - console-table-printer: 2.15.0 - p-queue: 6.6.2 - semver: 7.6.3 - uuid: 10.0.0 - optionalDependencies: - openai: 5.12.2(zod@3.25.76) - levn@0.4.1: dependencies: prelude-ls: 1.2.1 @@ -6922,6 +6797,8 @@ snapshots: make-error@1.3.6: {} + math-intrinsics@1.1.0: {} + media-typer@0.3.0: {} memory-pager@1.5.0: {} @@ -7124,8 +7001,6 @@ snapshots: type-is: 1.6.18 xtend: 4.0.2 - mustache@4.2.0: {} - mute-stream@0.0.8: {} natural-compare@1.4.0: {} @@ -7144,6 +7019,8 @@ snapshots: dependencies: clone: 2.1.2 + node-domexception@1.0.0: {} + node-fetch@2.7.0: dependencies: whatwg-url: 5.0.0 @@ -7247,11 +7124,19 @@ snapshots: dependencies: mimic-function: 5.0.1 - openai@5.12.2(zod@3.25.76): + openai@4.104.0(zod@3.25.76): + dependencies: + '@types/node': 18.19.130 + '@types/node-fetch': 2.6.13 + abort-controller: 3.0.0 + agentkeepalive: 4.6.0 + form-data-encoder: 1.7.2 + formdata-node: 4.4.1 + node-fetch: 2.7.0 optionalDependencies: zod: 3.25.76 - - openapi-types@12.1.3: {} + transitivePeerDependencies: + - encoding optionator@0.9.4: dependencies: @@ -7276,8 +7161,6 @@ snapshots: os-tmpdir@1.0.2: {} - p-finally@1.0.0: {} - p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -7294,20 +7177,6 @@ snapshots: dependencies: p-limit: 4.0.0 - p-queue@6.6.2: - dependencies: - eventemitter3: 4.0.7 - p-timeout: 3.2.0 - - p-retry@4.6.2: - dependencies: - '@types/retry': 0.12.0 - retry: 0.13.1 - - p-timeout@3.2.0: - dependencies: - p-finally: 1.0.0 - package-json-from-dist@1.0.1: {} parent-module@1.0.1: @@ -7462,8 +7331,6 @@ snapshots: onetime: 7.0.0 signal-exit: 4.1.0 - retry@0.13.1: {} - reusify@1.0.4: {} rfdc@1.4.1: {} @@ -7588,8 +7455,6 @@ snapshots: dependencies: semver: 7.6.3 - simple-wcswidth@1.1.2: {} - slice-ansi@5.0.0: dependencies: ansi-styles: 6.2.1 @@ -7899,6 +7764,8 @@ snapshots: undefsafe@2.0.5: {} + undici-types@5.26.5: {} + undici-types@6.19.8: {} unicorn-magic@0.1.0: {} @@ -7913,8 +7780,6 @@ snapshots: utils-merge@1.0.1: {} - uuid@10.0.0: {} - uuid@9.0.1: {} v8-compile-cache-lib@3.0.1: {} @@ -7927,6 +7792,8 @@ snapshots: dependencies: defaults: 1.0.4 + web-streams-polyfill@4.0.0-beta.3: {} + webidl-conversions@3.0.1: {} webidl-conversions@7.0.0: {} @@ -8048,8 +7915,5 @@ snapshots: yocto-queue@1.1.1: {} - zod-to-json-schema@3.25.0(zod@3.25.76): - dependencies: - zod: 3.25.76 - - zod@3.25.76: {} + zod@3.25.76: + optional: true diff --git a/src/modules/chatbot/chatbot.controller.ts b/src/modules/chatbot/chatbot.controller.ts index 52385ce..bf3a00c 100644 --- a/src/modules/chatbot/chatbot.controller.ts +++ b/src/modules/chatbot/chatbot.controller.ts @@ -102,14 +102,11 @@ class ChatbotController extends BaseController { res.end(); } catch (error) { console.error(error); - res.write( - `data: ${JSON.stringify({ type: "error", data: "خطا در تولید پاسخ هوشمند. لطفاً دوباره تلاش کنید ⚠️" })}\n\n`, - ); + res.write(`data: ${JSON.stringify({ type: "error", data: "خطا در تولید پاسخ هوشمند. لطفاً دوباره تلاش کنید ⚠️" })}\n\n`); res.end(); } } - @ApiOperation("Close a chat session") @ApiResponse("Chat session closed successfully") @ApiParam("sessionId", "Session ID", true) diff --git a/src/modules/chatbot/constants/chatbot.constants.ts b/src/modules/chatbot/constants/chatbot.constants.ts index 5eec06c..cb5de5f 100644 --- a/src/modules/chatbot/constants/chatbot.constants.ts +++ b/src/modules/chatbot/constants/chatbot.constants.ts @@ -1,5 +1,5 @@ export const CHATBOT_CONSTANTS = { - DEFAULT_MODEL: "gemini-2.0-flash", + DEFAULT_MODEL: "gpt-4o", DEFAULT_TEMPERATURE: 0.7, DEFAULT_MAX_TOKENS: 2000, MAX_CONVERSATION_HISTORY: 20, diff --git a/src/modules/chatbot/providers/chatbot.service.ts b/src/modules/chatbot/providers/chatbot.service.ts index aded06c..f12d506 100644 --- a/src/modules/chatbot/providers/chatbot.service.ts +++ b/src/modules/chatbot/providers/chatbot.service.ts @@ -26,7 +26,7 @@ export class ChatbotService { @inject(IOCTYPES.ChatbotChatMessageRepository) private chatMessageRepo: ChatMessageRepository, ) { this.logger = new Logger("ChatbotService"); - this.logger.info("Using Google Gemini as LLM provider"); + this.logger.info("Using OpenAI as LLM provider"); } async createChatSession(userId: string, createDto: CreateChatSessionDto) { @@ -104,7 +104,7 @@ export class ChatbotService { // Update session last message time await this.chatSessionRepo.updateLastMessageTime(sendDto.sessionId); - // Generate bot response asynchronously using original Gemini service + // Generate bot response asynchronously using OpenAI service this.generateBotResponse(sendDto.sessionId, userMessage._id.toString(), userId); return this.mapMessageToDto(userMessage); @@ -289,5 +289,4 @@ export class ChatbotService { tokensUsed: messageObj.tokensUsed, }; } - } diff --git a/src/modules/chatbot/providers/llm.service.ts b/src/modules/chatbot/providers/llm.service.ts index e33f601..f067aa9 100644 --- a/src/modules/chatbot/providers/llm.service.ts +++ b/src/modules/chatbot/providers/llm.service.ts @@ -1,5 +1,5 @@ -import { GoogleGenerativeAI, HarmBlockThreshold, HarmCategory } from "@google/generative-ai"; import { inject, injectable } from "inversify"; +import OpenAI from "openai"; import { DataContextService } from "./data-context.service"; import { Logger } from "../../../core/logging/logger"; @@ -10,24 +10,26 @@ import { IChatContext, IChatbotResponse, ILLMConfig } from "../interfaces/chatbo @injectable() export class LLMService { private readonly logger: Logger; - private genAI: GoogleGenerativeAI; + private openai: OpenAI; private config: ILLMConfig; constructor(@inject(IOCTYPES.ChatbotDataContextService) private dataContextService: DataContextService) { this.logger = new Logger("LLMService"); this.config = { - model: process.env.GEMINI_MODEL || CHATBOT_CONSTANTS.DEFAULT_MODEL, - temperature: Number(process.env.GEMINI_TEMPERATURE || CHATBOT_CONSTANTS.DEFAULT_TEMPERATURE), - maxTokens: Number(process.env.GEMINI_MAX_TOKENS || CHATBOT_CONSTANTS.DEFAULT_MAX_TOKENS), - topP: Number(process.env.GEMINI_TOP_P || "0.95"), - apiKey: process.env.GEMINI_API_KEY || "", + model: process.env.OPENAI_BASE_URL || CHATBOT_CONSTANTS.DEFAULT_MODEL, + temperature: Number(process.env.OPENAI_TEMPERATURE || CHATBOT_CONSTANTS.DEFAULT_TEMPERATURE), + maxTokens: Number(process.env.OPENAI_MAX_TOKENS || CHATBOT_CONSTANTS.DEFAULT_MAX_TOKENS), + topP: Number(process.env.OPENAI_TOP_P || "0.95"), + apiKey: process.env.OPENAI_API_KEY || "", }; if (!this.config.apiKey) { - throw new Error("GEMINI_API_KEY is required"); + throw new Error("OPENAI_API_KEY is required"); } - this.genAI = new GoogleGenerativeAI(this.config.apiKey); + this.openai = new OpenAI({ + apiKey: this.config.apiKey, + }); } async generateResponse(message: string, context: IChatContext): Promise { @@ -38,71 +40,52 @@ export class LLMService { // Build system instruction with context const systemInstruction = this.buildSystemInstruction(relevantData); - // Get the generative model with system instruction - const model = this.genAI.getGenerativeModel({ - model: this.config.model, - systemInstruction, - generationConfig: { - temperature: this.config.temperature, - maxOutputTokens: this.config.maxTokens, - topP: this.config.topP, - }, - safetySettings: [ - { - category: HarmCategory.HARM_CATEGORY_HARASSMENT, - threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, - }, - { - category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, - threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, - }, - { - category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, - threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, - }, - { - category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, - threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, - }, - ], - }); - // Build conversation history const conversationHistory = this.buildConversationHistory(context); - // Generate response using conversation history or direct message - let result; - if (conversationHistory.length > 0) { - // Use chat session for multi-turn conversation - const chat = model.startChat({ - history: conversationHistory, - }); - result = await chat.sendMessage(message); - } else { - // Single message generation - result = await model.generateContent(message); - } + // Build messages array for OpenAI + const messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [ + { + role: "system", + content: systemInstruction, + }, + ...conversationHistory, + { + role: "user", + content: message, + }, + ]; - const response = await result.response; - const botMessage = response.text() || "متأسفم، نمی‌توانم پاسخی تولید کنم. لطفاً سوال خود را دوباره مطرح کنید. 🤖"; + // Generate response using OpenAI + const completion = await this.openai.chat.completions.create({ + model: this.config.model, + messages, + temperature: this.config.temperature, + max_tokens: this.config.maxTokens, + top_p: this.config.topP, + }); - // Calculate token usage (approximate) - const tokensUsed = this.estimateTokens(systemInstruction) + this.estimateTokens(message) + this.estimateTokens(botMessage); + const botMessage = + completion.choices[0]?.message?.content || + "متأسفم، نمی‌توانم پاسخی تولید کنم. لطفاً سوال خود را دوباره مطرح کنید. 🤖"; + + // Calculate token usage from OpenAI response + const tokensUsed = (completion.usage?.total_tokens || 0) + this.estimateTokens(systemInstruction); return { message: botMessage, - confidence: this.calculateConfidence(response), + confidence: this.calculateConfidence(completion), sources: relevantData.sources, tokensUsed, context: { model: this.config.model, relevantDataFound: relevantData.data.length > 0, - finishReason: response.candidates?.[0]?.finishReason || "unknown", - safetyRatings: response.candidates?.[0]?.safetyRatings || [], + finishReason: completion.choices[0]?.finish_reason || "unknown", + usage: completion.usage, }, }; } catch (error) { - this.logger.error("Failed to generate Gemini response", error); + this.logger.error("Failed to generate OpenAI response", error); throw new Error("Failed to generate response from AI service"); } } @@ -115,33 +98,35 @@ export class LLMService { // Build system instruction with context const systemInstruction = this.buildSystemInstruction(relevantData); - // Get the generative model - const model = this.genAI.getGenerativeModel({ - model: this.config.model, - systemInstruction, - generationConfig: { - temperature: this.config.temperature, - maxOutputTokens: this.config.maxTokens, - topP: this.config.topP, - }, - }); - // Build conversation history const conversationHistory = this.buildConversationHistory(context); - let streamResult; - if (conversationHistory.length > 0) { - const chat = model.startChat({ - history: conversationHistory, - }); - streamResult = await chat.sendMessageStream(message); - } else { - streamResult = await model.generateContentStream(message); - } + // Build messages array for OpenAI + const messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [ + { + role: "system", + content: systemInstruction, + }, + ...conversationHistory, + { + role: "user", + content: message, + }, + ]; - return this.createAsyncIterableFromStream(streamResult); + // Generate streaming response using OpenAI + const stream = await this.openai.chat.completions.create({ + model: this.config.model, + messages, + temperature: this.config.temperature, + max_tokens: this.config.maxTokens, + top_p: this.config.topP, + stream: true, + }); + + return this.createAsyncIterableFromStream(stream); } catch (error) { - this.logger.error("Failed to generate streaming Gemini response", error); + this.logger.error("Failed to generate streaming OpenAI response", error); throw new Error("Failed to generate streaming response from AI service"); } } @@ -159,65 +144,57 @@ export class LLMService { return instruction; } - private buildConversationHistory(context: IChatContext): Array<{ role: string; parts: Array<{ text: string }> }> { + private buildConversationHistory(context: IChatContext): OpenAI.Chat.Completions.ChatCompletionMessageParam[] { if (!context.conversationHistory || context.conversationHistory.length === 0) { return []; } - const history = []; + const history: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = []; const recentHistory = context.conversationHistory .slice(-CHATBOT_CONSTANTS.MAX_CONVERSATION_HISTORY) .filter((msg) => msg.type !== "system"); for (const msg of recentHistory) { history.push({ - role: msg.type === "user" ? "user" : "model", - parts: [{ text: msg.content }], + role: msg.type === "user" ? "user" : "assistant", + content: msg.content, }); } return history; } - private async *createAsyncIterableFromStream(streamResult: any): AsyncIterable { + private async *createAsyncIterableFromStream(stream: AsyncIterable): AsyncIterable { try { - // For Google Generative AI, the streamResult itself is the async iterable - for await (const chunk of streamResult.stream) { - const chunkText = chunk.text(); - if (chunkText) { - yield chunkText; + for await (const chunk of stream) { + const content = chunk.choices[0]?.delta?.content; + if (content) { + yield content; } } } catch (error) { this.logger.error("Error in streaming response", error); - - // If the above doesn't work, try alternative approach for older SDK versions - try { - const response = await streamResult.response; - const text = response.text(); - if (text) { - yield text; - } - } catch (fallbackError) { - this.logger.error("Fallback streaming approach also failed", fallbackError); - throw new Error("Failed to process streaming response"); - } + throw new Error("Failed to process streaming response"); } } - private calculateConfidence(response: any): number { - const text = response.text() || ""; + private calculateConfidence(completion: OpenAI.Chat.Completions.ChatCompletion): number { + const text = completion.choices[0]?.message?.content || ""; - // Check safety ratings - lower confidence if blocked - const safetyRatings = response.candidates?.[0]?.safetyRatings || []; - const hasHighRiskRatings = safetyRatings.some((rating: any) => rating.probability === "HIGH" || rating.probability === "MEDIUM"); - - if (hasHighRiskRatings) { + // Check finish reason - lower confidence if stopped early + const finishReason = completion.choices[0]?.finish_reason; + if (finishReason === "length" || finishReason === "content_filter") { return 0.4; } // Check for uncertainty indicators - if (text.includes("I don't know") || text.includes("I'm not sure") || text.includes("uncertain")) { + if ( + text.includes("I don't know") || + text.includes("I'm not sure") || + text.includes("uncertain") || + text.includes("نمی‌دانم") || + text.includes("مطمئن نیستم") + ) { return 0.3; } @@ -227,7 +204,7 @@ export class LLMService { } // Check if response uses provided data - if (text.includes("based on") || text.includes("according to")) { + if (text.includes("based on") || text.includes("according to") || text.includes("بر اساس") || text.includes("طبق")) { return 0.95; } @@ -236,7 +213,7 @@ export class LLMService { private estimateTokens(text: string): number { // Rough estimation: 1 token ≈ 4 characters for English text - // Gemini uses similar tokenization to other models + // OpenAI uses similar tokenization to other models return Math.ceil(text.length / 4); } }