diff --git a/package-lock.json b/package-lock.json index b3916115..3aed652c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,8 +20,7 @@ "ansi-colors": "^4.1.3", "axios": "^1.6.7", "js-tiktoken": "^1.0.14", - "node-loader": "^2.0.0", - "npm": "^10.8.2" + "node-loader": "^2.0.0" }, "devDependencies": { "@ai-sdk/anthropic": "^0.0.41", @@ -30,6 +29,7 @@ "@changesets/cli": "^2.27.1", "@google-cloud/vertexai": "^1.5.0", "@google/generative-ai": "^0.1.3", + "@mistralai/mistralai": "^1.0.4", "@opentelemetry/exporter-trace-otlp-http": "^0.53.0", "@pinecone-database/pinecone": "^2.0.1", "@qdrant/js-client-rest": "^1.9.0", @@ -45,7 +45,9 @@ "eslint-plugin-promise": "^6.0.1", "eslint-plugin-unused-imports": "^2.0.0", "groq-sdk": "^0.3.3", + "i": "^0.3.7", "llamaindex": "^0.1.21", + "npm": "^10.8.3", "ollama": "^0.5.2", "openai": "^4.47.1", "pgvector": "^0.1.8", @@ -3953,7 +3955,6 @@ "version": "1.26.0", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.26.0.tgz", "integrity": "sha512-0SvDXmou/JjzSDOjUmetAAvcKQW6ZrvosU0rkbDGpXvvZN+pQF6JbK/Kd4hNdK4q/22yeruqvukXEJyySTzyTQ==", - "dev": true, "dependencies": { "@opentelemetry/core": "1.26.0", "@opentelemetry/resources": "1.26.0" @@ -3969,7 +3970,6 @@ "version": "1.26.0", "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.26.0.tgz", "integrity": "sha512-1iKxXXE8415Cdv0yjG3G6hQnB5eVEsJce3QaawX8SjDn0mAS0ZM8fAbZZJD4ajvhC15cePvosSCut404KrIIvQ==", - "dev": true, "dependencies": { "@opentelemetry/semantic-conventions": "1.27.0" }, @@ -3984,7 +3984,6 @@ "version": "1.26.0", "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.26.0.tgz", "integrity": "sha512-CPNYchBE7MBecCSVy0HKpUISEeJOniWqcHaAHpmasZ3j9o6V3AyBzhRc90jdmemq0HOxDr6ylhUbDhBqqPpeNw==", - "dev": true, "dependencies": { "@opentelemetry/core": "1.26.0", "@opentelemetry/semantic-conventions": "1.27.0" @@ -4000,7 +3999,6 @@ "version": "1.27.0", "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.27.0.tgz", "integrity": "sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg==", - "dev": true, "engines": { "node": ">=14" } @@ -9185,6 +9183,15 @@ "ms": "^2.0.0" } }, + "node_modules/i": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/i/-/i-0.3.7.tgz", + "integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -10365,7 +10372,8 @@ "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true }, "node_modules/lodash.startcase": { "version": "4.4.0", @@ -10992,9 +11000,9 @@ } }, "node_modules/npm": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/npm/-/npm-10.8.2.tgz", - "integrity": "sha512-x/AIjFIKRllrhcb48dqUNAAZl0ig9+qMuN91RpZo3Cb2+zuibfh+KISl6+kVVyktDz230JKc208UkQwwMqyB+w==", + "version": "10.8.3", + "resolved": "https://registry.npmjs.org/npm/-/npm-10.8.3.tgz", + "integrity": "sha512-0IQlyAYvVtQ7uOhDFYZCGK8kkut2nh8cpAdA9E6FvRSJaTgtZRZgNjlC5ZCct//L73ygrpY93CxXpRJDtNqPVg==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -11065,6 +11073,7 @@ "which", "write-file-atomic" ], + "dev": true, "workspaces": [ "docs", "smoke-tests", @@ -11085,13 +11094,13 @@ "@sigstore/tuf": "^2.3.4", "abbrev": "^2.0.0", "archy": "~1.0.0", - "cacache": "^18.0.3", + "cacache": "^18.0.4", "chalk": "^5.3.0", "ci-info": "^4.0.0", "cli-columns": "^4.0.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", - "glob": "^10.4.2", + "glob": "^10.4.5", "graceful-fs": "^4.2.11", "hosted-git-info": "^7.0.2", "ini": "^4.1.3", @@ -11100,7 +11109,7 @@ "json-parse-even-better-errors": "^3.0.2", "libnpmaccess": "^8.0.6", "libnpmdiff": "^6.1.4", - "libnpmexec": "^8.1.3", + "libnpmexec": "^8.1.4", "libnpmfund": "^5.0.12", "libnpmhook": "^10.0.5", "libnpmorg": "^6.0.6", @@ -11114,12 +11123,12 @@ "minipass": "^7.1.1", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", - "node-gyp": "^10.1.0", + "node-gyp": "^10.2.0", "nopt": "^7.2.1", "normalize-package-data": "^6.0.2", "npm-audit-report": "^5.0.0", "npm-install-checks": "^6.3.0", - "npm-package-arg": "^11.0.2", + "npm-package-arg": "^11.0.3", "npm-pick-manifest": "^9.1.0", "npm-profile": "^10.0.0", "npm-registry-fetch": "^17.1.0", @@ -11130,7 +11139,7 @@ "proc-log": "^4.2.0", "qrcode-terminal": "^0.12.0", "read": "^3.0.1", - "semver": "^7.6.2", + "semver": "^7.6.3", "spdx-expression-parse": "^4.0.0", "ssri": "^10.0.6", "supports-color": "^9.4.0", @@ -11152,6 +11161,7 @@ }, "node_modules/npm/node_modules/@isaacs/cliui": { "version": "8.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11168,6 +11178,7 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { "version": "6.0.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11179,11 +11190,13 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { "version": "9.2.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11200,6 +11213,7 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { "version": "7.1.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11214,11 +11228,13 @@ }, "node_modules/npm/node_modules/@isaacs/string-locale-compare": { "version": "1.1.0", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/agent": { "version": "2.2.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11234,6 +11250,7 @@ }, "node_modules/npm/node_modules/@npmcli/arborist": { "version": "7.5.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11282,6 +11299,7 @@ }, "node_modules/npm/node_modules/@npmcli/config": { "version": "8.3.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11300,6 +11318,7 @@ }, "node_modules/npm/node_modules/@npmcli/fs": { "version": "3.1.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11311,6 +11330,7 @@ }, "node_modules/npm/node_modules/@npmcli/git": { "version": "5.0.8", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11330,6 +11350,7 @@ }, "node_modules/npm/node_modules/@npmcli/installed-package-contents": { "version": "2.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11345,6 +11366,7 @@ }, "node_modules/npm/node_modules/@npmcli/map-workspaces": { "version": "3.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11359,6 +11381,7 @@ }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { "version": "7.1.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11374,6 +11397,7 @@ }, "node_modules/npm/node_modules/@npmcli/name-from-folder": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11382,6 +11406,7 @@ }, "node_modules/npm/node_modules/@npmcli/node-gyp": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11390,6 +11415,7 @@ }, "node_modules/npm/node_modules/@npmcli/package-json": { "version": "5.2.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11407,6 +11433,7 @@ }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { "version": "7.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11418,6 +11445,7 @@ }, "node_modules/npm/node_modules/@npmcli/query": { "version": "3.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11429,6 +11457,7 @@ }, "node_modules/npm/node_modules/@npmcli/redact": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11437,6 +11466,7 @@ }, "node_modules/npm/node_modules/@npmcli/run-script": { "version": "8.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11453,6 +11483,7 @@ }, "node_modules/npm/node_modules/@pkgjs/parseargs": { "version": "0.11.0", + "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -11462,6 +11493,7 @@ }, "node_modules/npm/node_modules/@sigstore/bundle": { "version": "2.3.2", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -11473,6 +11505,7 @@ }, "node_modules/npm/node_modules/@sigstore/core": { "version": "1.1.0", + "dev": true, "inBundle": true, "license": "Apache-2.0", "engines": { @@ -11481,6 +11514,7 @@ }, "node_modules/npm/node_modules/@sigstore/protobuf-specs": { "version": "0.3.2", + "dev": true, "inBundle": true, "license": "Apache-2.0", "engines": { @@ -11489,6 +11523,7 @@ }, "node_modules/npm/node_modules/@sigstore/sign": { "version": "2.3.2", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -11505,6 +11540,7 @@ }, "node_modules/npm/node_modules/@sigstore/tuf": { "version": "2.3.4", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -11517,6 +11553,7 @@ }, "node_modules/npm/node_modules/@sigstore/verify": { "version": "1.2.1", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -11530,6 +11567,7 @@ }, "node_modules/npm/node_modules/@tufjs/canonical-json": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11538,6 +11576,7 @@ }, "node_modules/npm/node_modules/@tufjs/models": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11550,6 +11589,7 @@ }, "node_modules/npm/node_modules/abbrev": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11558,6 +11598,7 @@ }, "node_modules/npm/node_modules/agent-base": { "version": "7.1.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11569,6 +11610,7 @@ }, "node_modules/npm/node_modules/aggregate-error": { "version": "3.1.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11581,6 +11623,7 @@ }, "node_modules/npm/node_modules/ansi-regex": { "version": "5.0.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11589,6 +11632,7 @@ }, "node_modules/npm/node_modules/ansi-styles": { "version": "6.2.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11600,21 +11644,25 @@ }, "node_modules/npm/node_modules/aproba": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/archy": { "version": "1.0.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/balanced-match": { "version": "1.0.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/bin-links": { "version": "4.0.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11629,6 +11677,7 @@ }, "node_modules/npm/node_modules/binary-extensions": { "version": "2.3.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11640,6 +11689,7 @@ }, "node_modules/npm/node_modules/brace-expansion": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11647,7 +11697,8 @@ } }, "node_modules/npm/node_modules/cacache": { - "version": "18.0.3", + "version": "18.0.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11670,6 +11721,7 @@ }, "node_modules/npm/node_modules/chalk": { "version": "5.3.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11681,6 +11733,7 @@ }, "node_modules/npm/node_modules/chownr": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11689,6 +11742,7 @@ }, "node_modules/npm/node_modules/ci-info": { "version": "4.0.0", + "dev": true, "funding": [ { "type": "github", @@ -11703,6 +11757,7 @@ }, "node_modules/npm/node_modules/cidr-regex": { "version": "4.1.1", + "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -11714,6 +11769,7 @@ }, "node_modules/npm/node_modules/clean-stack": { "version": "2.2.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11722,6 +11778,7 @@ }, "node_modules/npm/node_modules/cli-columns": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11734,6 +11791,7 @@ }, "node_modules/npm/node_modules/cmd-shim": { "version": "6.0.3", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -11742,6 +11800,7 @@ }, "node_modules/npm/node_modules/color-convert": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11753,16 +11812,19 @@ }, "node_modules/npm/node_modules/color-name": { "version": "1.1.4", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/common-ancestor-path": { "version": "1.0.1", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/cross-spawn": { "version": "7.0.3", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11776,6 +11838,7 @@ }, "node_modules/npm/node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11790,6 +11853,7 @@ }, "node_modules/npm/node_modules/cssesc": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "MIT", "bin": { @@ -11800,7 +11864,8 @@ } }, "node_modules/npm/node_modules/debug": { - "version": "4.3.5", + "version": "4.3.6", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11817,11 +11882,13 @@ }, "node_modules/npm/node_modules/debug/node_modules/ms": { "version": "2.1.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/diff": { "version": "5.2.0", + "dev": true, "inBundle": true, "license": "BSD-3-Clause", "engines": { @@ -11830,16 +11897,19 @@ }, "node_modules/npm/node_modules/eastasianwidth": { "version": "0.2.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/emoji-regex": { "version": "8.0.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/encoding": { "version": "0.1.13", + "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -11849,6 +11919,7 @@ }, "node_modules/npm/node_modules/env-paths": { "version": "2.2.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11857,16 +11928,19 @@ }, "node_modules/npm/node_modules/err-code": { "version": "2.0.3", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/exponential-backoff": { "version": "3.1.1", + "dev": true, "inBundle": true, "license": "Apache-2.0" }, "node_modules/npm/node_modules/fastest-levenshtein": { "version": "1.0.16", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11874,7 +11948,8 @@ } }, "node_modules/npm/node_modules/foreground-child": { - "version": "3.2.1", + "version": "3.3.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11890,6 +11965,7 @@ }, "node_modules/npm/node_modules/fs-minipass": { "version": "3.0.3", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11900,7 +11976,8 @@ } }, "node_modules/npm/node_modules/glob": { - "version": "10.4.2", + "version": "10.4.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11914,20 +11991,19 @@ "bin": { "glob": "dist/esm/bin.mjs" }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/npm/node_modules/graceful-fs": { "version": "4.2.11", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/hosted-git-info": { "version": "7.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11939,11 +12015,13 @@ }, "node_modules/npm/node_modules/http-cache-semantics": { "version": "4.1.1", + "dev": true, "inBundle": true, "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/http-proxy-agent": { "version": "7.0.2", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11956,6 +12034,7 @@ }, "node_modules/npm/node_modules/https-proxy-agent": { "version": "7.0.5", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11968,6 +12047,7 @@ }, "node_modules/npm/node_modules/iconv-lite": { "version": "0.6.3", + "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -11980,6 +12060,7 @@ }, "node_modules/npm/node_modules/ignore-walk": { "version": "6.0.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -11991,6 +12072,7 @@ }, "node_modules/npm/node_modules/imurmurhash": { "version": "0.1.4", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -11999,6 +12081,7 @@ }, "node_modules/npm/node_modules/indent-string": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12007,6 +12090,7 @@ }, "node_modules/npm/node_modules/ini": { "version": "4.1.3", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12015,6 +12099,7 @@ }, "node_modules/npm/node_modules/init-package-json": { "version": "6.0.3", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12032,6 +12117,7 @@ }, "node_modules/npm/node_modules/ip-address": { "version": "9.0.5", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12044,6 +12130,7 @@ }, "node_modules/npm/node_modules/ip-regex": { "version": "5.0.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12055,6 +12142,7 @@ }, "node_modules/npm/node_modules/is-cidr": { "version": "5.1.0", + "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -12066,6 +12154,7 @@ }, "node_modules/npm/node_modules/is-fullwidth-code-point": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12074,24 +12163,24 @@ }, "node_modules/npm/node_modules/is-lambda": { "version": "1.0.1", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/isexe": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/jackspeak": { - "version": "3.4.0", + "version": "3.4.3", + "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" }, - "engines": { - "node": ">=14" - }, "funding": { "url": "https://github.com/sponsors/isaacs" }, @@ -12101,11 +12190,13 @@ }, "node_modules/npm/node_modules/jsbn": { "version": "1.1.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/json-parse-even-better-errors": { "version": "3.0.2", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12114,6 +12205,7 @@ }, "node_modules/npm/node_modules/json-stringify-nice": { "version": "1.1.4", + "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -12122,6 +12214,7 @@ }, "node_modules/npm/node_modules/jsonparse": { "version": "1.3.1", + "dev": true, "engines": [ "node >= 0.2.0" ], @@ -12130,16 +12223,19 @@ }, "node_modules/npm/node_modules/just-diff": { "version": "6.0.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/just-diff-apply": { "version": "5.5.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { "version": "8.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12152,6 +12248,7 @@ }, "node_modules/npm/node_modules/libnpmdiff": { "version": "6.1.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12169,7 +12266,8 @@ } }, "node_modules/npm/node_modules/libnpmexec": { - "version": "8.1.3", + "version": "8.1.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12190,6 +12288,7 @@ }, "node_modules/npm/node_modules/libnpmfund": { "version": "5.0.12", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12201,6 +12300,7 @@ }, "node_modules/npm/node_modules/libnpmhook": { "version": "10.0.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12213,6 +12313,7 @@ }, "node_modules/npm/node_modules/libnpmorg": { "version": "6.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12225,6 +12326,7 @@ }, "node_modules/npm/node_modules/libnpmpack": { "version": "7.0.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12239,6 +12341,7 @@ }, "node_modules/npm/node_modules/libnpmpublish": { "version": "9.0.9", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12257,6 +12360,7 @@ }, "node_modules/npm/node_modules/libnpmsearch": { "version": "7.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12268,6 +12372,7 @@ }, "node_modules/npm/node_modules/libnpmteam": { "version": "6.0.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12280,6 +12385,7 @@ }, "node_modules/npm/node_modules/libnpmversion": { "version": "6.0.3", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12294,15 +12400,14 @@ } }, "node_modules/npm/node_modules/lru-cache": { - "version": "10.2.2", + "version": "10.4.3", + "dev": true, "inBundle": true, - "license": "ISC", - "engines": { - "node": "14 || >=16.14" - } + "license": "ISC" }, "node_modules/npm/node_modules/make-fetch-happen": { "version": "13.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12325,6 +12430,7 @@ }, "node_modules/npm/node_modules/minimatch": { "version": "9.0.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12339,6 +12445,7 @@ }, "node_modules/npm/node_modules/minipass": { "version": "7.1.2", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12347,6 +12454,7 @@ }, "node_modules/npm/node_modules/minipass-collect": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12358,6 +12466,7 @@ }, "node_modules/npm/node_modules/minipass-fetch": { "version": "3.0.5", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12374,6 +12483,7 @@ }, "node_modules/npm/node_modules/minipass-flush": { "version": "1.0.5", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12385,6 +12495,7 @@ }, "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { "version": "3.3.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12396,6 +12507,7 @@ }, "node_modules/npm/node_modules/minipass-pipeline": { "version": "1.2.4", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12407,6 +12519,7 @@ }, "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { "version": "3.3.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12418,6 +12531,7 @@ }, "node_modules/npm/node_modules/minipass-sized": { "version": "1.0.3", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12429,6 +12543,7 @@ }, "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { "version": "3.3.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12440,6 +12555,7 @@ }, "node_modules/npm/node_modules/minizlib": { "version": "2.1.2", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12452,6 +12568,7 @@ }, "node_modules/npm/node_modules/minizlib/node_modules/minipass": { "version": "3.3.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12463,6 +12580,7 @@ }, "node_modules/npm/node_modules/mkdirp": { "version": "1.0.4", + "dev": true, "inBundle": true, "license": "MIT", "bin": { @@ -12474,11 +12592,13 @@ }, "node_modules/npm/node_modules/ms": { "version": "2.1.3", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/mute-stream": { "version": "1.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12487,6 +12607,7 @@ }, "node_modules/npm/node_modules/negotiator": { "version": "0.6.3", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12494,7 +12615,8 @@ } }, "node_modules/npm/node_modules/node-gyp": { - "version": "10.1.0", + "version": "10.2.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12504,9 +12626,9 @@ "graceful-fs": "^4.2.6", "make-fetch-happen": "^13.0.0", "nopt": "^7.0.0", - "proc-log": "^3.0.0", + "proc-log": "^4.1.0", "semver": "^7.3.5", - "tar": "^6.1.2", + "tar": "^6.2.1", "which": "^4.0.0" }, "bin": { @@ -12516,16 +12638,9 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/node-gyp/node_modules/proc-log": { - "version": "3.0.0", - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/npm/node_modules/nopt": { "version": "7.2.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12540,6 +12655,7 @@ }, "node_modules/npm/node_modules/normalize-package-data": { "version": "6.0.2", + "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -12553,6 +12669,7 @@ }, "node_modules/npm/node_modules/npm-audit-report": { "version": "5.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12561,6 +12678,7 @@ }, "node_modules/npm/node_modules/npm-bundled": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12572,6 +12690,7 @@ }, "node_modules/npm/node_modules/npm-install-checks": { "version": "6.3.0", + "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -12583,6 +12702,7 @@ }, "node_modules/npm/node_modules/npm-normalize-package-bin": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12590,7 +12710,8 @@ } }, "node_modules/npm/node_modules/npm-package-arg": { - "version": "11.0.2", + "version": "11.0.3", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12605,6 +12726,7 @@ }, "node_modules/npm/node_modules/npm-packlist": { "version": "8.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12616,6 +12738,7 @@ }, "node_modules/npm/node_modules/npm-pick-manifest": { "version": "9.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12630,6 +12753,7 @@ }, "node_modules/npm/node_modules/npm-profile": { "version": "10.0.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12642,6 +12766,7 @@ }, "node_modules/npm/node_modules/npm-registry-fetch": { "version": "17.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12660,6 +12785,7 @@ }, "node_modules/npm/node_modules/npm-user-validate": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "BSD-2-Clause", "engines": { @@ -12668,6 +12794,7 @@ }, "node_modules/npm/node_modules/p-map": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12682,11 +12809,13 @@ }, "node_modules/npm/node_modules/package-json-from-dist": { "version": "1.0.0", + "dev": true, "inBundle": true, "license": "BlueOak-1.0.0" }, "node_modules/npm/node_modules/pacote": { "version": "18.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12717,6 +12846,7 @@ }, "node_modules/npm/node_modules/parse-conflict-json": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12730,6 +12860,7 @@ }, "node_modules/npm/node_modules/path-key": { "version": "3.1.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12738,6 +12869,7 @@ }, "node_modules/npm/node_modules/path-scurry": { "version": "1.11.1", + "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -12752,7 +12884,8 @@ } }, "node_modules/npm/node_modules/postcss-selector-parser": { - "version": "6.1.0", + "version": "6.1.2", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12765,6 +12898,7 @@ }, "node_modules/npm/node_modules/proc-log": { "version": "4.2.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12773,6 +12907,7 @@ }, "node_modules/npm/node_modules/proggy": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12781,6 +12916,7 @@ }, "node_modules/npm/node_modules/promise-all-reject-late": { "version": "1.0.1", + "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -12789,6 +12925,7 @@ }, "node_modules/npm/node_modules/promise-call-limit": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -12797,11 +12934,13 @@ }, "node_modules/npm/node_modules/promise-inflight": { "version": "1.0.1", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/promise-retry": { "version": "2.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12814,6 +12953,7 @@ }, "node_modules/npm/node_modules/promzard": { "version": "1.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12825,6 +12965,7 @@ }, "node_modules/npm/node_modules/qrcode-terminal": { "version": "0.12.0", + "dev": true, "inBundle": true, "bin": { "qrcode-terminal": "bin/qrcode-terminal.js" @@ -12832,6 +12973,7 @@ }, "node_modules/npm/node_modules/read": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12843,6 +12985,7 @@ }, "node_modules/npm/node_modules/read-cmd-shim": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12851,6 +12994,7 @@ }, "node_modules/npm/node_modules/read-package-json-fast": { "version": "3.0.2", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -12863,6 +13007,7 @@ }, "node_modules/npm/node_modules/retry": { "version": "0.12.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12871,12 +13016,14 @@ }, "node_modules/npm/node_modules/safer-buffer": { "version": "2.1.2", + "dev": true, "inBundle": true, "license": "MIT", "optional": true }, "node_modules/npm/node_modules/semver": { - "version": "7.6.2", + "version": "7.6.3", + "dev": true, "inBundle": true, "license": "ISC", "bin": { @@ -12888,6 +13035,7 @@ }, "node_modules/npm/node_modules/shebang-command": { "version": "2.0.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12899,6 +13047,7 @@ }, "node_modules/npm/node_modules/shebang-regex": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12907,6 +13056,7 @@ }, "node_modules/npm/node_modules/signal-exit": { "version": "4.1.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -12918,6 +13068,7 @@ }, "node_modules/npm/node_modules/sigstore": { "version": "2.3.1", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -12934,6 +13085,7 @@ }, "node_modules/npm/node_modules/smart-buffer": { "version": "4.2.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -12943,6 +13095,7 @@ }, "node_modules/npm/node_modules/socks": { "version": "2.8.3", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12956,6 +13109,7 @@ }, "node_modules/npm/node_modules/socks-proxy-agent": { "version": "8.0.4", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12969,6 +13123,7 @@ }, "node_modules/npm/node_modules/spdx-correct": { "version": "3.2.0", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -12978,6 +13133,7 @@ }, "node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -12987,11 +13143,13 @@ }, "node_modules/npm/node_modules/spdx-exceptions": { "version": "2.5.0", + "dev": true, "inBundle": true, "license": "CC-BY-3.0" }, "node_modules/npm/node_modules/spdx-expression-parse": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13001,16 +13159,19 @@ }, "node_modules/npm/node_modules/spdx-license-ids": { "version": "3.0.18", + "dev": true, "inBundle": true, "license": "CC0-1.0" }, "node_modules/npm/node_modules/sprintf-js": { "version": "1.1.3", + "dev": true, "inBundle": true, "license": "BSD-3-Clause" }, "node_modules/npm/node_modules/ssri": { "version": "10.0.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13022,6 +13183,7 @@ }, "node_modules/npm/node_modules/string-width": { "version": "4.2.3", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13036,6 +13198,7 @@ "node_modules/npm/node_modules/string-width-cjs": { "name": "string-width", "version": "4.2.3", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13049,6 +13212,7 @@ }, "node_modules/npm/node_modules/strip-ansi": { "version": "6.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13061,6 +13225,7 @@ "node_modules/npm/node_modules/strip-ansi-cjs": { "name": "strip-ansi", "version": "6.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13072,6 +13237,7 @@ }, "node_modules/npm/node_modules/supports-color": { "version": "9.4.0", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -13083,6 +13249,7 @@ }, "node_modules/npm/node_modules/tar": { "version": "6.2.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13099,6 +13266,7 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { "version": "2.1.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13110,6 +13278,7 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { "version": "3.3.6", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13121,6 +13290,7 @@ }, "node_modules/npm/node_modules/tar/node_modules/minipass": { "version": "5.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -13129,16 +13299,19 @@ }, "node_modules/npm/node_modules/text-table": { "version": "0.2.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/tiny-relative-date": { "version": "1.3.0", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/treeverse": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -13147,6 +13320,7 @@ }, "node_modules/npm/node_modules/tuf-js": { "version": "2.2.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13160,6 +13334,7 @@ }, "node_modules/npm/node_modules/unique-filename": { "version": "3.0.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13171,6 +13346,7 @@ }, "node_modules/npm/node_modules/unique-slug": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13182,11 +13358,13 @@ }, "node_modules/npm/node_modules/util-deprecate": { "version": "1.0.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/validate-npm-package-license": { "version": "3.0.4", + "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -13196,6 +13374,7 @@ }, "node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13205,6 +13384,7 @@ }, "node_modules/npm/node_modules/validate-npm-package-name": { "version": "5.0.1", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -13213,11 +13393,13 @@ }, "node_modules/npm/node_modules/walk-up-path": { "version": "3.0.1", + "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/which": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13232,6 +13414,7 @@ }, "node_modules/npm/node_modules/which/node_modules/isexe": { "version": "3.1.1", + "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -13240,6 +13423,7 @@ }, "node_modules/npm/node_modules/wrap-ansi": { "version": "8.1.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13257,6 +13441,7 @@ "node_modules/npm/node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13273,6 +13458,7 @@ }, "node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { "version": "4.3.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13287,6 +13473,7 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { "version": "6.0.1", + "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -13298,11 +13485,13 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { "version": "9.2.2", + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { "version": "5.1.2", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13319,6 +13508,7 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { "version": "7.1.0", + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -13333,6 +13523,7 @@ }, "node_modules/npm/node_modules/write-file-atomic": { "version": "5.0.1", + "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -13345,6 +13536,7 @@ }, "node_modules/npm/node_modules/yallist": { "version": "4.0.0", + "dev": true, "inBundle": true, "license": "ISC" }, @@ -16955,4 +17147,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 344cefda..e9c48b76 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,7 @@ "ansi-colors": "^4.1.3", "axios": "^1.6.7", "js-tiktoken": "^1.0.14", - "node-loader": "^2.0.0", - "npm": "^10.8.2" + "node-loader": "^2.0.0" }, "devDependencies": { "@ai-sdk/anthropic": "^0.0.41", @@ -42,6 +41,7 @@ "@changesets/cli": "^2.27.1", "@google-cloud/vertexai": "^1.5.0", "@google/generative-ai": "^0.1.3", + "@mistralai/mistralai": "^1.0.4", "@opentelemetry/exporter-trace-otlp-http": "^0.53.0", "@pinecone-database/pinecone": "^2.0.1", "@qdrant/js-client-rest": "^1.9.0", @@ -57,7 +57,9 @@ "eslint-plugin-promise": "^6.0.1", "eslint-plugin-unused-imports": "^2.0.0", "groq-sdk": "^0.3.3", + "i": "^0.3.7", "llamaindex": "^0.1.21", + "npm": "^10.8.3", "ollama": "^0.5.2", "openai": "^4.47.1", "pgvector": "^0.1.8", @@ -65,4 +67,4 @@ "typescript": "^4.9.5", "weaviate-ts-client": "^2.2.0" } -} \ No newline at end of file +} diff --git a/src/examples/entrypoint.ts b/src/examples/entrypoint.ts index 5313853d..a3076595 100644 --- a/src/examples/entrypoint.ts +++ b/src/examples/entrypoint.ts @@ -1,3 +1,3 @@ -import { chatCompletion } from '@langtrace-examples/mistral/chat-complete' +import { basic } from '@langtrace-examples/llamaindex/basic' -void chatCompletion() +void basic() diff --git a/src/examples/llamaindex/basic.ts b/src/examples/llamaindex/basic.ts index be8f8e7b..9f2dd7c7 100644 --- a/src/examples/llamaindex/basic.ts +++ b/src/examples/llamaindex/basic.ts @@ -1,38 +1,89 @@ + import { init } from '@langtrace-init/init' -import type { BaseReader, Metadata } from 'llamaindex' +import type { BaseReader, Metadata, NodeWithScore } from 'llamaindex' import { withLangTraceRootSpan } from '@langtrace-utils/instrumentation' import dotenv from 'dotenv' import { + CorrectnessEvaluator, Document, - FILE_EXT_TO_READER, IngestionPipeline, QuestionsAnsweredExtractor, - SimpleDirectoryReader, - TextFileReader, + ResponseSynthesizer, + TextNode, TitleExtractor, - VectorStoreIndex + VectorStoreIndex, + SentenceSplitter } from 'llamaindex' dotenv.config() -init({ batch: false, write_spans_to_console: true }) +init({ batch: false, api_key: '986fd03796f14f6a1009f6a65866e39ae850cd14e1f7348260dfc04ef5ab38a7' }) +// Initialize the root span to trace the operations export async function basic (): Promise { await withLangTraceRootSpan(async (spanId, traceId) => { - // // Create Document object with essay - const document = new Document({ text: "Author of 'React' and 'Redux' books. He is a software engineer at Facebook. He studied at the University of Moscow and studied engineering" }) + // Step 1: Load documents using the loader function + const documents = await loader() + + // Step 2: Split documents into sentences using SentenceSplitter before indexing + const splitter = new SentenceSplitter({ chunkSize: 20 }) + const splitDocuments: Document[] = [] + + for (const doc of documents) { + const sentenceChunks = splitter.splitText(doc.text) + console.info('Sentence Chunks:', sentenceChunks) + sentenceChunks.forEach((chunk, index) => { + splitDocuments.push(new Document({ text: chunk, metadata: { part: index + 1 } })) + }) + } + console.info('Split Documents:', splitDocuments) - // // Split text and create embeddings. Store them in a VectorStoreIndex - const index = await VectorStoreIndex.fromDocuments([document]) + // Step 3: Create a VectorStoreIndex from the split documents + const index = await VectorStoreIndex.fromDocuments(splitDocuments) - // Query the index + // Step 4: Query the index using QueryEngine const queryEngine = index.asQueryEngine() - const response = await queryEngine.query({ query: 'What did the author do in college?' }) - // Output response - console.info(response.toString()) + const query = 'What did the author do in college?' + const response = await queryEngine.query({ query }) + console.info('Query Response:', response.toString()) + + // Step 5: Retrieve additional data using Retriever + const retriever = index.asRetriever() + const retrievedDocuments = await retriever.retrieve(query) + console.info('Retrieved Documents:', retrievedDocuments) + + // Step 6: Evaluate the query response using CorrectnessEvaluator + const evaluator = new CorrectnessEvaluator({}) + const evaluationResult = await evaluator.evaluateResponse({ query, response }) + const evaluationResult2 = await evaluator.evaluate({ query, response: response.response.toString() }) + console.info('Evaluation Result:', evaluationResult) + console.info('Evaluation Result 2:', evaluationResult2) + + // Step 7: Run the ingestion pipeline with transformations + const nodes = await runIngestionPipeline() + console.info('Transformed Nodes:', nodes) + + // Step 8: Synthesize a response using the ResponseSynthesizer + const responseSynthesizer = new ResponseSynthesizer() + const nodesWithScore: NodeWithScore[] = [ + { + node: new TextNode({ text: 'I am 10 years old.' }), + score: 1 + }, + { + node: new TextNode({ text: 'John is 20 years old.' }), + score: 0.5 + } + ] + const synthesizeResponse = await responseSynthesizer.synthesize({ + query: 'What age am I?', + nodesWithScore + }) + console.info('Synthesized Response:', synthesizeResponse) }) } -export async function extractor (): Promise { +// Ingestion pipeline to extract metadata and transform documents +export async function runIngestionPipeline (): Promise>> { const pipeline = new IngestionPipeline({ transformations: [ new TitleExtractor(), @@ -45,31 +96,20 @@ export async function extractor (): Promise { new Document({ text: 'I am 10 years old. John is 20 years old.' }) ] }) - - for (const node of nodes) { - console.info(node.metadata) - } + return nodes.map((node) => new Document(node)) } -export async function loader (): Promise { +// Loader function to read data +export async function loader (): Promise { class ZipReader implements BaseReader { // eslint-disable-next-line @typescript-eslint/require-await async loadData (): Promise>> { - throw new Error('Implement me') + return await runIngestionPipeline() } } - const reader = new SimpleDirectoryReader() - const documents = await reader.loadData({ - directoryPath: 'src/examples/llamaindex/data', - defaultReader: new TextFileReader(), - fileExtToReader: { - ...FILE_EXT_TO_READER, - zip: new ZipReader() - } - }) + const reader = new ZipReader() + const documents = await reader.loadData() - documents.forEach((doc) => { - console.info(`document (${doc.id_}):`, doc.getText()) - }) + return documents } diff --git a/src/instrumentation/llamaindex/instrumentation.ts b/src/instrumentation/llamaindex/instrumentation.ts index e10bb2d9..3e267035 100644 --- a/src/instrumentation/llamaindex/instrumentation.ts +++ b/src/instrumentation/llamaindex/instrumentation.ts @@ -26,8 +26,20 @@ import { import { version, name } from '../../../package.json' class LlamaIndexInstrumentation extends InstrumentationBase { + private readonly methodsToPatch: string[] constructor () { super(name, version) + this.methodsToPatch = + [ + 'query', 'retrieve', 'chat', + 'call', 'extract', 'loadData', + 'run', 'evaluateResponse', + 'evaluate', '_getPrompts', '_updatePrompts', + 'transform', 'fromDocuments', + 'getNodesFromDocuments', + 'synthesize', 'validatePrompts', + 'splitText' + ] } public manualPatch (llamaIndex: any): void { @@ -56,119 +68,29 @@ class LlamaIndexInstrumentation extends InstrumentationBase { } private _patch (llama: any, moduleVersion?: string): void { - // Note: Instrumenting only the core concepts of LlamaIndex SDK // https://github.com/run-llama/LlamaIndexTS?tab=readme-ov-file - for (const key in llama) { const cls = (llama)[key] if (cls.prototype !== undefined) { - if (cls.prototype.query !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'query') - } - this._wrap( - cls.prototype, - 'query', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.query`, - 'query', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) - } - if (cls.prototype.retrieve !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'retrieve') - } - this._wrap( - cls.prototype, - 'retrieve', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.retrieve`, - 'retrieve_data', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) - } - if (cls.prototype.chat !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'chat') - } - this._wrap( - cls.prototype, - 'chat', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.chat`, - 'chat', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) - } - if (cls.prototype.call !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'call') - } - this._wrap( - cls.prototype, - 'call', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.call`, - 'prompt', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) - } - if (cls.prototype.extract !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'extract') - } - this._wrap( - cls.prototype, - 'extract', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.extract`, - 'extract_data', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) - } - if (cls.prototype.loadData !== undefined) { - if (isWrapped(cls.prototype)) { - this._unwrap(cls.prototype, 'loadData') + for (const method of this.methodsToPatch) { + if (cls.prototype[method] !== undefined) { + if (isWrapped(cls.prototype)) { + this._unwrap(cls.prototype, method) + } + this._wrap( + cls.prototype, + method, + (originalMethod: (...args: any[]) => any) => + genericPatch( + originalMethod, + `llamaindex.${key}.${method}`, + method, + this.tracer, + this.instrumentationVersion, + moduleVersion + ) + ) } - this._wrap( - cls.prototype, - 'loadData', - (originalMethod: (...args: any[]) => any) => - genericPatch( - originalMethod, - `llamaindex.${key}.loadData`, - 'load_data', - this.tracer, - this.instrumentationVersion, - moduleVersion - ) - ) } } } @@ -178,23 +100,10 @@ class LlamaIndexInstrumentation extends InstrumentationBase { for (const key in llama) { const cls = (llama)[key] if (cls.prototype !== undefined) { - if (cls.prototype.query !== undefined) { - this._unwrap(cls.prototype, 'query') - } - if (cls.prototype.retrieve !== undefined) { - this._unwrap(cls.prototype, 'retrieve') - } - if (cls.prototype.chat !== undefined) { - this._unwrap(cls.prototype, 'chat') - } - if (cls.prototype.call !== undefined) { - this._unwrap(cls.prototype, 'call') - } - if (cls.prototype.extract !== undefined) { - this._unwrap(cls.prototype, 'extract') - } - if (cls.prototype.loadData !== undefined) { - this._unwrap(cls.prototype, 'loadData') + for (const method of this.methodsToPatch) { + if (isWrapped(cls.prototype)) { + this._unwrap(cls.prototype, method) + } } } } diff --git a/src/instrumentation/llamaindex/patch.ts b/src/instrumentation/llamaindex/patch.ts index dc05a6ec..1f85c7e6 100644 --- a/src/instrumentation/llamaindex/patch.ts +++ b/src/instrumentation/llamaindex/patch.ts @@ -1,29 +1,6 @@ -/* - * Copyright (c) 2024 Scale3 Labs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - import { LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY } from '@langtrace-constants/common' import { FrameworkSpanAttributes, Vendors } from '@langtrase/trace-attributes' -import { - Exception, - SpanKind, - SpanStatusCode, - Tracer, - context, - trace -} from '@opentelemetry/api' +import { Tracer, context, SpanKind, SpanStatusCode, Exception, trace } from '@opentelemetry/api' export function genericPatch ( originalMethod: (...args: any[]) => any, @@ -33,7 +10,7 @@ export function genericPatch ( langtraceVersion: string, version?: string ): (...args: any[]) => any { - return async function (this: any, ...args: any[]) { + return function (this: any, ...args: any[]) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return const customAttributes = context.active().getValue(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY) ?? {} const attributes: FrameworkSpanAttributes = { @@ -45,23 +22,49 @@ export function genericPatch ( 'llamaindex.task.name': task, ...customAttributes } + if (task !== 'llamaindex.SimpleVectorStore.query') { + attributes['llamaindex.inputs'] = JSON.stringify(args) + } const spanName = customAttributes['langtrace.span.name' as keyof typeof customAttributes] ?? method const span = tracer.startSpan(spanName, { kind: SpanKind.CLIENT, attributes }, context.active()) - return await context.with( - trace.setSpan(context.active(), span), - async () => { - try { - const response = await originalMethod.apply(this, args) + + const invokeMethod = (): any => { + try { + const result = originalMethod.apply(this, args) + if (result instanceof Promise) { + // Handle async function + return result + .then((response: any) => { + if (task !== 'llamaindex.SimpleVectorStore.query') { + span.setAttributes({ 'llamaindex.outputs': JSON.stringify(response) }) + } + span.setStatus({ code: SpanStatusCode.OK }) + span.end() + return response + }) + .catch((error: any) => { + span.recordException(error as Exception) + span.setStatus({ code: SpanStatusCode.ERROR }) + span.end() + throw error + }) + } else { + // Handle sync function + if (task !== 'llamaindex.SimpleVectorStore.query') { + span.setAttributes({ 'llamaindex.outputs': JSON.stringify(result) }) + } span.setStatus({ code: SpanStatusCode.OK }) span.end() - return response - } catch (error: any) { - span.recordException(error as Exception) - span.setStatus({ code: SpanStatusCode.ERROR }) - span.end() - throw error + return result } + } catch (error: any) { + span.recordException(error as Exception) + span.setStatus({ code: SpanStatusCode.ERROR }) + span.end() + throw error } - ) + } + + return context.with(trace.setSpan(context.active(), span), invokeMethod) } }