θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"html-to-text": "^9.0.5",
"ignore": "^5.3.0",
"js-tiktoken": "^1.0.8",
"langchain": "0.0.201",
"langchain": "0.1.36",
"mammoth": "^1.6.0",
"mbox-parser": "^1.0.1",
"mime": "^3.0.0",
Expand All @@ -49,4 +49,4 @@
"nodemon": "^2.0.22",
"prettier": "^2.4.1"
}
}
}
133 changes: 87 additions & 46 deletions collector/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,56 @@
dependencies:
googleapis-common "^6.0.3"

"@langchain/core@~0.0.8":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.0.9.tgz#3b4e74693eddcfa5f6e649857b561d3a9b60d1d4"
integrity sha512-TpGOvSY/nvpTx3ArVOJPqogfWroxnuD2eGnXvKRroB+DLyKKTxH7EODzgpLpf52C1x1aSnhYNlXoDAbePNNg4Q==
"@langchain/community@~0.0.47":
version "0.0.53"
resolved "https://registry.yarnpkg.com/@langchain/community/-/community-0.0.53.tgz#a9aaedffa0ed2977e8d302d74e9f90a49a6da037"
integrity sha512-iFqZPt4MRssGYsQoKSXWJQaYTZCC7WNuilp2JCCs3wKmJK3l6mR0eV+PDrnT+TaDHUVxt/b0rwgM0sOiy0j2jA==
dependencies:
"@langchain/core" "~0.1.60"
"@langchain/openai" "~0.0.28"
expr-eval "^2.0.2"
flat "^5.0.2"
langsmith "~0.1.1"
uuid "^9.0.0"
zod "^3.22.3"
zod-to-json-schema "^3.22.5"

"@langchain/core@~0.1", "@langchain/core@~0.1.56", "@langchain/core@~0.1.60":
version "0.1.61"
resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.1.61.tgz#9313363e04f1c6981a938b2909c44ce6fceb2736"
integrity sha512-C8OkAly+ugvXsL8TACCmFv9WTTcT4gvQaG6NbrXCOzibBCywfxxcTqEMOyg3zIKpxHEmR0DHqh0OiJRHocnsCg==
dependencies:
ansi-styles "^5.0.0"
camelcase "6"
decamelize "1.2.0"
js-tiktoken "^1.0.8"
langsmith "^0.0.48"
langsmith "~0.1.7"
ml-distance "^4.0.0"
mustache "^4.2.0"
p-queue "^6.6.2"
p-retry "4"
uuid "^9.0.0"
zod "^3.22.3"
zod "^3.22.4"
zod-to-json-schema "^3.22.3"

"@langchain/openai@~0.0.28":
version "0.0.28"
resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.0.28.tgz#afaeec61b44816935db9ae937496c964c81ab571"
integrity sha512-2s1RA3/eAnz4ahdzsMPBna9hfAqpFNlWdHiPxVGZ5yrhXsbLWWoPcF+22LCk9t0HJKtazi2GCIWc0HVXH9Abig==
dependencies:
"@langchain/core" "~0.1.56"
js-tiktoken "^1.0.7"
openai "^4.32.1"
zod "^3.22.4"
zod-to-json-schema "^3.22.3"

"@langchain/textsplitters@~0.0.0":
version "0.0.0"
resolved "https://registry.yarnpkg.com/@langchain/textsplitters/-/textsplitters-0.0.0.tgz#5fe05fcd86ad7f1b4766afacda482cba98a3d35d"
integrity sha512-3hPesWomnmVeYMppEGYbyv0v/sRUugUdlFBNn9m1ueJYHAIKbvCErkWxNUH3guyKKYgJVrkvZoQxcd9faucSaw==
dependencies:
"@langchain/core" "~0.1"
js-tiktoken "^1.0.11"

"@mapbox/node-pre-gyp@^1.0.10":
version "1.0.11"
Expand Down Expand Up @@ -1749,6 +1785,13 @@ jintr@^1.1.0:
dependencies:
acorn "^8.8.0"

js-tiktoken@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/js-tiktoken/-/js-tiktoken-1.0.11.tgz#d7d707b849f703841112660d9d55169424a35344"
integrity sha512-PajXFLq2vx7/8jllQZ43vzNpAai/0MOVdJjW/UrNyJorNQRTjHrqdGJG/mjHVy7h9M6dW6CaG43eNLMYFkTh6w==
dependencies:
base64-js "^1.5.1"

js-tiktoken@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/js-tiktoken/-/js-tiktoken-1.0.7.tgz#56933fcd2093e8304060dfde3071bda91812e6f5"
Expand Down Expand Up @@ -1826,50 +1869,39 @@ jws@^4.0.0:
jwa "^2.0.0"
safe-buffer "^5.0.1"

langchain@0.0.201:
version "0.0.201"
resolved "https://registry.yarnpkg.com/langchain/-/langchain-0.0.201.tgz#dd4aa2d3a57cf40f3a7d122cc8e42c4d8dce27c5"
integrity sha512-zbmKpH3zbCgzbBxBq/YBXKS9xTLqUzQoBqW2j7ctiVYwNq+wIGHef8YuVnDXlli6Wx0+3T2b4kTI8506xkriMg==
langchain@0.1.36:
version "0.1.36"
resolved "https://registry.yarnpkg.com/langchain/-/langchain-0.1.36.tgz#2f201f681d83fb265716e28e7dfcfe61fbeef2c2"
integrity sha512-NTbnCL/jKWIeEI//Nm1oG8nhW3vkYWvEMr1MPotmTThTfeKfO87eV/OAzAyh6Ruy6GFs/qofRgQZGIe6XvXTNQ==
dependencies:
"@anthropic-ai/sdk" "^0.9.1"
"@langchain/core" "~0.0.8"
"@langchain/community" "~0.0.47"
"@langchain/core" "~0.1.60"
"@langchain/openai" "~0.0.28"
"@langchain/textsplitters" "~0.0.0"
binary-extensions "^2.2.0"
expr-eval "^2.0.2"
flat "^5.0.2"
js-tiktoken "^1.0.7"
js-yaml "^4.1.0"
jsonpointer "^5.0.1"
langchainhub "~0.0.6"
langsmith "~0.0.48"
langchainhub "~0.0.8"
langsmith "~0.1.7"
ml-distance "^4.0.0"
openai "^4.19.0"
openapi-types "^12.1.3"
p-retry "4"
uuid "^9.0.0"
yaml "^2.2.1"
zod "^3.22.3"
zod-to-json-schema "3.20.3"
zod "^3.22.4"
zod-to-json-schema "^3.22.3"

langchainhub@~0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/langchainhub/-/langchainhub-0.0.6.tgz#9d2d06e4ce0807b4e8a31e19611f57aef990b54d"
integrity sha512-SW6105T+YP1cTe0yMf//7kyshCgvCTyFBMTgH2H3s9rTAR4e+78DA/BBrUL/Mt4Q5eMWui7iGuAYb3pgGsdQ9w==

langsmith@^0.0.48:
version "0.0.48"
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.0.48.tgz#3a9a8ce257271ddb43d01ebf585c4370a3a3ba79"
integrity sha512-s0hW8iZ90Q9XLTnDK0Pgee245URV3b1cXQjPDj5OKm1+KN7iSK1pKx+4CO7RcFLz58Ixe7Mt+mVcomYqUuryxQ==
dependencies:
"@types/uuid" "^9.0.1"
commander "^10.0.1"
p-queue "^6.6.2"
p-retry "4"
uuid "^9.0.0"
langchainhub@~0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/langchainhub/-/langchainhub-0.0.8.tgz#fd4b96dc795e22e36c1a20bad31b61b0c33d3110"
integrity sha512-Woyb8YDHgqqTOZvWIbm2CaFDGfZ4NTSyXV687AG4vXEfoNo7cGQp7nhl7wL3ehenKWmNEmcxCLgOZzW8jE6lOQ==

langsmith@~0.0.48:
version "0.0.49"
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.0.49.tgz#6b19298db6ca37a583ca05b25b5271674e9258b7"
integrity sha512-TC2RkjDizxtubClLNjLkB0m53NHtom9LHIhbdRYJ5O6gqUpcXkN/pefb8w734lBp9VYfnYBk/JJ8AiCq+ooeDQ==
langsmith@~0.1.1, langsmith@~0.1.7:
version "0.1.20"
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.1.20.tgz#5631391b1764811dc80e83b3424d2176d735a15f"
integrity sha512-xS/m2FWagJMo1W42GU08BEnRfFznnB8OZk3GUTg7tf0qNK5pqS5AnuOLCAmV7VJcfP3YkYZL12X/P0QE1ZQowA==
dependencies:
"@types/uuid" "^9.0.1"
commander "^10.0.1"
Expand Down Expand Up @@ -2199,6 +2231,11 @@ multer@^1.4.5-lts.1:
type-is "^1.6.4"
xtend "^4.0.0"

mustache@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64"
integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==

napi-build-utils@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
Expand Down Expand Up @@ -2404,16 +2441,15 @@ openai@^3.2.1:
axios "^0.26.0"
form-data "^4.0.0"

openai@^4.19.0:
version "4.20.1"
resolved "https://registry.yarnpkg.com/openai/-/openai-4.20.1.tgz#afa0d496d125b5a0f6cebcb4b9aeabf71e00214e"
integrity sha512-Dd3q8EvINfganZFtg6V36HjrMaihqRgIcKiHua4Nq9aw/PxOP48dhbsk8x5klrxajt5Lpnc1KTOG5i1S6BKAJA==
openai@^4.32.1:
version "4.38.5"
resolved "https://registry.yarnpkg.com/openai/-/openai-4.38.5.tgz#87de78eed9f7e63331fb6b1307d8c9dd986b39d0"
integrity sha512-Ym5GJL98ZhLJJ7enBx53jjG3vwN/fsB+Ozh46nnRZZS9W1NiYqbwkJ+sXd3dkCIiWIgcyyOPL2Zr8SQAzbpj3g==
dependencies:
"@types/node" "^18.11.18"
"@types/node-fetch" "^2.6.4"
abort-controller "^3.0.0"
agentkeepalive "^4.2.1"
digest-fetch "^1.3.0"
form-data-encoder "1.7.2"
formdata-node "^4.3.2"
node-fetch "^2.6.7"
Expand Down Expand Up @@ -3454,12 +3490,17 @@ youtubei.js@^9.1.0:
tslib "^2.5.0"
undici "^5.19.1"

zod-to-json-schema@3.20.3:
version "3.20.3"
resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.20.3.tgz#8c95d8c20f20455ffa0b4b526c29703f35f6d787"
integrity sha512-/Q3wnyxAfCt94ZcrGiXXoiAfRqasxl9CX64LZ9fj+4dKH68zulUtU0uk1WMxQPfAxQ0ZI70dKzcoW7hHj+DwSQ==
zod-to-json-schema@^3.22.3, zod-to-json-schema@^3.22.5:
version "3.23.0"
resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.23.0.tgz#4fc60e88d3c709eedbfaae3f92f8a7bf786469f2"
integrity sha512-az0uJ243PxsRIa2x1WmNE/pnuA05gUq/JB8Lwe1EDCCL/Fz9MgjYQ0fPlyc2Tcv6aF2ZA7WM5TWaRZVEFaAIag==

zod@^3.22.3:
version "3.22.4"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff"
integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==

zod@^3.22.4:
version "3.23.4"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.4.tgz#c63805b2f39e10d4ab3d55eb3c8cdb472c79dfb1"
integrity sha512-/AtWOKbBgjzEYYQRNfoGKHObgfAZag6qUJX1VbHo2PRBgS+wfWagEY2mizjfyAPcGesrJOcx/wcl0L9WnVrHFw==
9 changes: 7 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"@datastax/astra-db-ts": "^0.1.3",
"@google/generative-ai": "^0.7.1",
"@googleapis/youtube": "^9.0.0",
"@langchain/anthropic": "0.1.16",
"@langchain/community": "0.0.53",
"@langchain/core": "0.1.61",
"@langchain/openai": "0.0.28",
"@langchain/textsplitters": "0.0.0",
"@pinecone-database/pinecone": "^2.0.1",
"@prisma/client": "5.3.1",
"@qdrant/js-client-rest": "^1.4.0",
Expand All @@ -46,7 +51,7 @@
"joi-password-complexity": "^5.2.0",
"js-tiktoken": "^1.0.7",
"jsonwebtoken": "^8.5.1",
"langchain": "0.0.201",
"langchain": "0.1.36",
"mime": "^3.0.0",
"moment": "^2.29.4",
"multer": "^1.4.5-lts.1",
Expand Down Expand Up @@ -84,4 +89,4 @@
"nodemon": "^2.0.22",
"prettier": "^3.0.3"
}
}
}
6 changes: 3 additions & 3 deletions server/utils/AiProviders/native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const {
clientAbortedHandler,
} = require("../../helpers/chat/responses");

// Docs: https://api.js.langchain.com/classes/chat_models_llama_cpp.ChatLlamaCpp.html
// Docs: https://js.langchain.com/docs/integrations/chat/llama_cpp
const ChatLlamaCpp = (...args) =>
import("langchain/chat_models/llama_cpp").then(
import("@langchain/community/chat_models/llama_cpp").then(
({ ChatLlamaCpp }) => new ChatLlamaCpp(...args)
);

Expand Down Expand Up @@ -64,7 +64,7 @@ class NativeLLM {
HumanMessage,
SystemMessage,
AIMessage,
} = require("langchain/schema");
} = require("@langchain/core/messages");
const langchainChats = [];
const roleToMessageMap = {
system: SystemMessage,
Expand Down
6 changes: 3 additions & 3 deletions server/utils/AiProviders/ollama/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { chatPrompt } = require("../../chats");
const { StringOutputParser } = require("langchain/schema/output_parser");
const { StringOutputParser } = require("@langchain/core/output_parsers");
const {
writeResponseChunk,
clientAbortedHandler,
Expand Down Expand Up @@ -28,7 +28,7 @@ class OllamaAILLM {
}

#ollamaClient({ temperature = 0.07 }) {
const { ChatOllama } = require("langchain/chat_models/ollama");
const { ChatOllama } = require("@langchain/community/chat_models/ollama");
return new ChatOllama({
baseUrl: this.basePath,
model: this.model,
Expand All @@ -44,7 +44,7 @@ class OllamaAILLM {
HumanMessage,
SystemMessage,
AIMessage,
} = require("langchain/schema");
} = require("@langchain/core/messages");
const langchainChats = [];
const roleToMessageMap = {
system: SystemMessage,
Expand Down
2 changes: 1 addition & 1 deletion server/utils/TextSplitter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RecursiveSplitter {
constructor({ chunkSize, chunkOverlap }) {
const {
RecursiveCharacterTextSplitter,
} = require("langchain/text_splitter");
} = require("@langchain/textsplitters");
this.log(`Will split with`, { chunkSize, chunkOverlap });
this.engine = new RecursiveCharacterTextSplitter({
chunkSize,
Expand Down
10 changes: 5 additions & 5 deletions server/utils/agents/aibitat/providers/ai-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* A service that provides an AI client to create a completion.
*/

const { ChatOpenAI } = require("langchain/chat_models/openai");
const { ChatAnthropic } = require("langchain/chat_models/anthropic");
const { ChatOpenAI } = require("@langchain/openai");
const { ChatAnthropic } = require("@langchain/anthropic");

class Provider {
_client;
Expand All @@ -22,17 +22,17 @@ class Provider {
switch (provider) {
case "openai":
return new ChatOpenAI({
openAIApiKey: process.env.OPEN_AI_KEY,
apiKey: process.env.OPEN_AI_KEY,
...config,
});
case "anthropic":
return new ChatAnthropic({
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
apiKey: process.env.ANTHROPIC_API_KEY,
...config,
});
default:
return new ChatOpenAI({
openAIApiKey: process.env.OPEN_AI_KEY,
apiKey: process.env.OPEN_AI_KEY,
...config,
});
}
Expand Down
4 changes: 2 additions & 2 deletions server/utils/agents/aibitat/utils/summarize.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { loadSummarizationChain } = require("langchain/chains");
const { PromptTemplate } = require("langchain/prompts");
const { RecursiveCharacterTextSplitter } = require("langchain/text_splitter");
const { PromptTemplate } = require("@langchain/core/prompts");
const { RecursiveCharacterTextSplitter } = require("@langchain/textsplitters");
const Provider = require("../providers/ai-provider");
/**
* Summarize content using OpenAI's GPT-3.5 model.
Expand Down
4 changes: 0 additions & 4 deletions server/utils/vectorDbProviders/lance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const {
getLLMProvider,
getEmbeddingEngineSelection,
} = require("../../helpers");
const { OpenAIEmbeddings } = require("langchain/embeddings/openai");
const { TextSplitter } = require("../../TextSplitter");
const { SystemSettings } = require("../../../models/systemSettings");
const { storeVectorResult, cachedVectorInformation } = require("../../files");
Expand Down Expand Up @@ -57,9 +56,6 @@ const LanceDb = {
const table = await client.openTable(_namespace);
return (await table.countRows()) || 0;
},
embedder: function () {
return new OpenAIEmbeddings({ openAIApiKey: process.env.OPEN_AI_KEY });
},
similarityResponse: async function (
client,
namespace,
Expand Down
Loading