Flowise [功能] 添加 AWS Bedrock 知识库检索器

vohkndzv  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(62)

你好,

由于langchain支持AWS Bedrock知识库,并在2天前扩展了langchain/aws v0.0.6版本,增加了过滤和搜索类型的功能,因此将其添加到Flowise中实现AWS Bedrock知识库检索对象是一个很好的补充。

附加上下文

提出的解决方案对象:

bkkx9g8r

bkkx9g8r1#

你好,

我在我这边完成了实现(https://github.com/RPKosec/Flowise/tree/feature/aws-bedrock-kbases-2901)。只有一个问题让我无法解决。如果我将@langchain/aws库添加到Flowise/packages/components/package.json中,运行pnpm build时会出现这个错误:

• Packages in scope: flowise, flowise-components, flowise-ui
• Running build in 3 packages
• Remote caching disabled
flowise-ui:build: cache miss, executing 80f41654be1cc236
flowise-components:build: cache miss, executing 7f5f3134c7c65564
flowise-ui:build: 
flowise-ui:build: > flowise-ui@2.0.1 build /home/node/Flowise/packages/ui
flowise-ui:build: > vite build
flowise-ui:build: 
flowise-components:build: 
flowise-components:build: > flowise-components@2.0.1 build /home/node/Flowise/packages/components
flowise-components:build: > tsc && gulp
flowise-components:build: 
flowise-ui:build: The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
flowise-ui:build: vite v5.1.6 building for production...
flowise-ui:build: transforming...
flowise-components:build: nodes/chatmodels/ChatFireworks/ChatFireworks.ts(74,41): error TS2345: Argument of type 'Partial<ChatFireworks>' is not assignable to parameter of type 'Partial<Omit<OpenAIChatInput, "openAIApiKey" | FireworksUnsupportedArgs>> & BaseLanguageModelParams & { ...; }'.
flowise-components:build:   Type 'Partial<ChatFireworks>' is not assignable to type 'BaseLanguageModelParams'.
flowise-components:build:     Types of property 'callbacks' are incompatible.
flowise-components:build:       Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined'.
flowise-components:build:         Type 'CallbackManager' is not assignable to type 'Callbacks | undefined'.
flowise-components:build:           Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager'.
flowise-components:build:             The types returned by 'handleLLMStart(...)' are incompatible between these types.
flowise-components:build:               Type 'Promise<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>' is not assignable to type 'Promise<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>'.
flowise-components:build:                 Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]'.
flowise-components:build:                   Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun'.
flowise-components:build:                     Property 'inheritableHandlers' is protected but type 'BaseRunManager' is not a class derived from 'BaseRunManager'.
flowise-components:build: nodes/documentloaders/FireCrawl/FireCrawl.ts(353,46): error TS2345: Argument of type 'TextSplitter' is not assignable to parameter of type 'BaseDocumentTransformer<DocumentInterface<Record<string, any>>[], DocumentInterface<Record<string, any>>[]>'.
flowise-components:build:   Types of property 'invoke' are incompatible.
flowise-components:build:     Type '(input: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/document").DocumentInterface<Record<string, any>>[], _options?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+...' is not assignable to type '(input: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/document").DocumentInterface<Record<string, any>>[], _options?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+...'.
flowise-components:build:       Types of parameters '_options' and '_options' are incompatible.
flowise-components:build:         Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").BaseCallbackConfig | undefined' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").BaseCallbackConfig | undefined'.
flowise-components:build:           Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").BaseCallbackConfig' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").BaseCallbackConfig'.
flowise-components:build:             Types of property 'callbacks' are incompatible.
flowise-components:build:               Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined'.
flowise-components:build:                 Type 'CallbackManager' is not assignable to type 'Callbacks | undefined'.
flowise-components:build:                   Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager'.
flowise-components:build:                     Types of property 'handlers' are incompatible.
flowise-components:build:                       Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/base").BaseCallbackHandler[]' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/base").BaseCallbackHandler[]'.
flowise-components:build:                         Property 'ignoreCustomEvent' is missing in type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/base").BaseCallbackHandler' but required in type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/callbacks/base").BaseCallbackHandler'.
flowise-components:build: nodes/documentloaders/Folder/Folder.ts(108,35): error TS2322: Type 'CSVLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build:   Types of property 'loadAndSplit' are incompatible.
flowise-components:build:     Type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain...' is not assignable to type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain...'.
flowise-components:build:       Types of parameters 'splitter' and 'splitter' are incompatible.
flowise-components:build:         Type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6...' is not assignable to type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6...'.
flowise-components:build:           Property 'asTool' is missing in type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6...' but required in type 'import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6...'.
flowise-components:build: nodes/documentloaders/Folder/Folder.ts(109,36): error TS2322: Type 'DocxLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build:   Types of property 'loadAndSplit' are incompatible.
flowise-components:build:     Type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain...' is not assignable to type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain...'.
flowise-components:build: nodes/documentloaders/Folder/Folder.ts(111,21): error TS2322: Type 'PDFLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build:   Types of property 'loadAndSplit' are incompatible.
flowise-components:build:     Type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.16_langchain...' is not assignable to type '(splitter?: import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain@0.2.8_s4um6b5xxxz2w2gdjs5ybvlwba__openai@4.51.0_encoding@0.1.13_/node_modules/@langchain/core/dist/documents/transformers").BaseDocumentTransformer<import("/home/node/Flowise/node_modules/.pnpm/@langchain+core@0.2.14_langchain...'.
flowise-components:build: nodes/documentloaders/S3Directory/S3Directory.ts(225,39): error TS2322: Type 'CSVLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build: nodes/documentloaders/S3Directory/S3Directory.ts(226,40): error TS2322: Type 'DocxLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build: nodes/documentloaders/S3Directory/S3Directory.ts(228,25): error TS2322: Type 'PDFLoader' is not assignable to type 'BaseDocumentLoader'.
flowise-components:build: nodes/documentloaders/Spider/Spider.ts(180,46): error TS2345: Argument of type 'TextSplitter' is not assignable to parameter of type 'BaseDocumentTransformer<DocumentInterface<Record<string, any>>[], DocumentInterface<Record<string, any>>[]>'.
flowise-components:build:  ELIFECYCLE  Command failed with exit code 2.
flowise-components:build: ERROR: command finished with error: command (/home/node/Flowise/packages/components) pnpm run build exited (2)
flowise-components#build: command (/home/node/Flowise/packages/components) pnpm run build exited (2)

 Tasks:    0 successful, 2 total
Cached:    0 cached, 2 total
  Time:    1m27.85s 
Failed:    flowise-components#build

 ERROR  run failed: command  exited (2)
 ELIFECYCLE  Command failed with exit code 2.

如果将@langchain/aws作为根packages.json的依赖项添加,就不会出现错误。但这不是正确处理依赖关系的方法,所以我请求帮助,如何解决这个问题。看起来是其他模块中使用的依赖项之间的冲突。

qyyhg6bp

qyyhg6bp2#

感谢贡献!是的,这确实看起来像是一个依赖问题。有时候我别无选择,只能在根目录下进行覆盖 - https://github.com/FlowiseAI/Flowise/blob/main/package.json#L61
请随时提出一个草案PR,我们可以查看一下!

mfuanj7w

mfuanj7w3#

你好。我按照你的建议更改了依赖关系,并将@langchain/aws移动到overrides中。现在一切都可以构建和运行,所以我提交了草稿PR。

相关问题