From 45d995a7d398f017f5d70cb2597d2221bbf96aa3 Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Sun, 17 Mar 2024 11:34:16 +0100 Subject: [PATCH] npm: fork mistralai client, override its dependency, document why, update langchain --- src/packages/package.json | 4 +- src/packages/package.json.md | 11 ++++++ src/packages/pnpm-lock.yaml | 64 +++++++++++++++++--------------- src/packages/server/package.json | 12 ++---- 4 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 src/packages/package.json.md diff --git a/src/packages/package.json b/src/packages/package.json index 99b61e29200..0bdff6796c1 100644 --- a/src/packages/package.json +++ b/src/packages/package.json @@ -19,7 +19,9 @@ "es5-ext@<0.10.63": "^0.10.63", "undici@<5.28.3": "^5.28.3", "postcss@<8.4.31": "^8.4.31", - "retry-request@<7.0.1": "^7.0.2" + "retry-request@<7.0.1": "^7.0.2", + "@langchain/core": "^0.1.48", + "@mistralai/mistralai": "@cocalc/mistralai" } } } diff --git a/src/packages/package.json.md b/src/packages/package.json.md new file mode 100644 index 00000000000..027cd71b703 --- /dev/null +++ b/src/packages/package.json.md @@ -0,0 +1,11 @@ +# Notes about package.js + +## Overrides + +Since we have workspaces, they must be in the root `package.json` + +- `@mistralai/mistralai` + - Overrides the global `fetch` command and we fix this essentially by merging in https://github.com/mistralai/client-js/pull/42 + - Remove the override and delete our fork once https://github.com/mistralai/client-js/issues/44 is fixed +- `@langchain/core` + - Pinning its version is strongly recommended: https://js.langchain.com/docs/get_started/installation#installing-integration-packages diff --git a/src/packages/pnpm-lock.yaml b/src/packages/pnpm-lock.yaml index b80d7b4319a..860cd495edd 100644 --- a/src/packages/pnpm-lock.yaml +++ b/src/packages/pnpm-lock.yaml @@ -10,6 +10,8 @@ overrides: undici@<5.28.3: ^5.28.3 postcss@<8.4.31: ^8.4.31 retry-request@<7.0.1: ^7.0.2 + '@langchain/core': ^0.1.48 + '@mistralai/mistralai': '@cocalc/mistralai' importers: @@ -1328,6 +1330,9 @@ importers: '@cocalc/gcloud-pricing-calculator': specifier: ^1.7.0 version: 1.7.0 + '@cocalc/mistralai': + specifier: ^0.0.2 + version: 0.0.2(encoding@0.1.13) '@cocalc/server': specifier: workspace:* version: 'link:' @@ -1350,14 +1355,14 @@ importers: specifier: ^1.2.1 version: 1.2.1 '@langchain/community': - specifier: ^0.0.38 - version: 0.0.38(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21) + specifier: ^0.0.40 + version: 0.0.40(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21) '@langchain/core': - specifier: ^0.1.46 - version: 0.1.46 + specifier: ^0.1.48 + version: 0.1.48 '@langchain/mistralai': - specifier: ^0.0.13 - version: 0.0.13(encoding@0.1.13) + specifier: ^0.0.14 + version: 0.0.14 '@node-saml/passport-saml': specifier: ^4.0.4 version: 4.0.4 @@ -3160,6 +3165,14 @@ packages: resolution: {integrity: sha512-5ck4Oc7KsRttG7W6n9kRHVn0uUVHqwVIqQPLvuUtEyUEI7+0gtnvhZrvB4yiwOfeEeFQ63spIWenM6J/sp2B/w==} dev: false + /@cocalc/mistralai@0.0.2(encoding@0.1.13): + resolution: {integrity: sha512-L5EkeO4OuNZW0ikwbxyGKys1GrGWGqmvUaFOLiWubm5F4ZKko13E+KxSuIN+UOyDCjKWvY8jlgX6sgMZG5lt8Q==} + dependencies: + node-fetch: 2.6.7(encoding@0.1.13) + transitivePeerDependencies: + - encoding + dev: false + /@cocalc/primus-multiplex@1.1.0: resolution: {integrity: sha512-o8AOFVs996NQ2nvCjoSzNkBJRkPYi5XVPw0BbtMZUz+hnegSCfGawT59S++wta0CzGdFPWnyPtQqVJpobQlT4w==} requiresBuild: true @@ -4052,8 +4065,8 @@ packages: - crypto dev: false - /@langchain/community@0.0.38(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21): - resolution: {integrity: sha512-JIPgVYjDecG7iQh7VejLwm9QihA51ptvPHyV5Acx3+wyO1tSRLNTWUCcuPEbqLsB5zM0Gl+A6Z35DbC00gMhoA==} + /@langchain/community@0.0.40(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21): + resolution: {integrity: sha512-a+uZ1+FyZ2tLBybAf1bPc+gm/8OgYLU+Z7h/r41ThRTHbMlnT7hiC8LFHX/zsm9H7mZ/dbpRSBuz/MFxS/TlBA==} engines: {node: '>=18'} peerDependencies: '@aws-crypto/sha256-js': ^5.0.0 @@ -4109,6 +4122,7 @@ packages: closevector-web: 0.1.6 cohere-ai: '*' convex: ^1.3.1 + couchbase: ^4.3.0 discord.js: ^14.14.1 dria: ^0.0.3 faiss-node: ^0.5.1 @@ -4248,6 +4262,8 @@ packages: optional: true convex: optional: true + couchbase: + optional: true discord.js: optional: true dria: @@ -4314,7 +4330,7 @@ packages: optional: true dependencies: '@google-ai/generativelanguage': 1.1.0(encoding@0.1.13) - '@langchain/core': 0.1.46 + '@langchain/core': 0.1.48 '@langchain/openai': 0.0.19(encoding@0.1.13) flat: 5.0.2 google-auth-library: 9.4.1(encoding@0.1.13) @@ -4326,8 +4342,8 @@ packages: - encoding dev: false - /@langchain/core@0.1.46: - resolution: {integrity: sha512-UmPukG3rrYKdTWvMtXpF6o3HG6uV5DlbdMdmfT/Bne4rMXwrFmUMVw40R1q2kI+CXOuh9SMmYxpz0jS3I7maog==} + /@langchain/core@0.1.48: + resolution: {integrity: sha512-kGggyDbaYzCIPGkzvMvm/v0+lcTy1jlX6QZ7PSzUQFYJg5JK399x3AOYIDkbbUVxBAyHRgrWlxVQXH0FW3N6Bg==} engines: {node: '>=18'} dependencies: ansi-styles: 5.2.0 @@ -4343,23 +4359,21 @@ packages: zod-to-json-schema: 3.22.4(zod@3.22.4) dev: false - /@langchain/mistralai@0.0.13(encoding@0.1.13): - resolution: {integrity: sha512-0oNTICsukEnZLJ1HwtlCADZi5jqircK8B+svLrRbp+1HVue5hXPsU36b54mr0WEwhmY0QIXJ9CwEaGRSfEEZcg==} + /@langchain/mistralai@0.0.14: + resolution: {integrity: sha512-gEMqjpA+/iQFpWVO2Ldtv9nqZ9Mryaxjj0v5eJ3YTSSDHVZ0U++bW8ach9BZiAJ4G/N1hZakapz+5SHRPv1QNw==} engines: {node: '>=18'} dependencies: - '@langchain/core': 0.1.46 - '@mistralai/mistralai': 0.1.3(encoding@0.1.13) + '@langchain/core': 0.1.48 + '@mistralai/mistralai': link:@cocalc/mistralai zod: 3.22.4 zod-to-json-schema: 3.22.4(zod@3.22.4) - transitivePeerDependencies: - - encoding dev: false /@langchain/openai@0.0.18(encoding@0.1.13): resolution: {integrity: sha512-SBY1PlwiHIcjW185yVXHo4XXgTVAyGxw7IHpuEqs7201/EVjFW91HskzGRvduYm2td3/NV91BBVFgXhJQcvtmA==} engines: {node: '>=18'} dependencies: - '@langchain/core': 0.1.46 + '@langchain/core': 0.1.48 js-tiktoken: 1.0.10 openai: 4.27.0(encoding@0.1.13) zod: 3.22.4 @@ -4372,7 +4386,7 @@ packages: resolution: {integrity: sha512-b1CHZCNVc2u4LZbFc1Ls0T7U4LWNGvMeQsrNidLZT5jbjg6VzzDZuVCDPGqCwUc8bzFWvPBO52oT1Wy+aCOX6w==} engines: {node: '>=18'} dependencies: - '@langchain/core': 0.1.46 + '@langchain/core': 0.1.48 js-tiktoken: 1.0.10 openai: 4.27.0(encoding@0.1.13) zod: 3.22.4 @@ -4573,14 +4587,6 @@ packages: - encoding dev: false - /@mistralai/mistralai@0.1.3(encoding@0.1.13): - resolution: {integrity: sha512-WUHxC2xdeqX9PTXJEqdiNY54vT2ir72WSJrZTTBKRnkfhX6zIfCYA24faRlWjUB5WTpn+wfdGsTMl3ArijlXFA==} - dependencies: - node-fetch: 2.6.7(encoding@0.1.13) - transitivePeerDependencies: - - encoding - dev: false - /@next/env@14.1.0: resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} dev: false @@ -13160,8 +13166,8 @@ packages: dependencies: '@anthropic-ai/sdk': 0.9.1(encoding@0.1.13) '@google-ai/generativelanguage': 1.1.0(encoding@0.1.13) - '@langchain/community': 0.0.38(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21) - '@langchain/core': 0.1.46 + '@langchain/community': 0.0.40(@google-ai/generativelanguage@1.1.0)(encoding@0.1.13)(google-auth-library@9.4.1)(lodash@4.17.21) + '@langchain/core': 0.1.48 '@langchain/openai': 0.0.18(encoding@0.1.13) axios: 1.6.7 binary-extensions: 2.2.0 diff --git a/src/packages/server/package.json b/src/packages/server/package.json index 4c1867d3abd..cf28e1df6b1 100644 --- a/src/packages/server/package.json +++ b/src/packages/server/package.json @@ -39,6 +39,7 @@ "@cocalc/backend": "workspace:*", "@cocalc/database": "workspace:*", "@cocalc/gcloud-pricing-calculator": "^1.7.0", + "@cocalc/mistralai": "^0.0.2", "@cocalc/server": "workspace:*", "@cocalc/util": "workspace:*", "@google-ai/generativelanguage": "^1.1.0", @@ -46,9 +47,9 @@ "@google-cloud/monitoring": "^4.0.0", "@google/generative-ai": "^0.1.3", "@isaacs/ttlcache": "^1.2.1", - "@langchain/community": "^0.0.38", - "@langchain/core": "^0.1.46", - "@langchain/mistralai": "^0.0.13", + "@langchain/community": "^0.0.40", + "@langchain/core": "^0.1.48", + "@langchain/mistralai": "^0.0.14", "@node-saml/passport-saml": "^4.0.4", "@passport-js/passport-twitter": "^1.0.8", "@passport-next/passport-google-oauth2": "^1.0.0", @@ -120,10 +121,5 @@ "devDependencies": { "@types/node": "^18.16.14", "expect": "^26.6.2" - }, - "pnpm": { - "overrides": { - "@langchain/core": "^0.1.46" - } } }