mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Fix merge conflict
This commit is contained in:
+3
-2
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
不确定要贡献什么?一些想法:
|
不确定要贡献什么?一些想法:
|
||||||
|
|
||||||
- 从 Langchain 创建新组件
|
- 从 `packages/components` 创建新组件
|
||||||
- 更新现有组件,如扩展功能、修复错误
|
- 更新现有组件,如扩展功能、修复错误
|
||||||
- 添加新的 Chatflow 想法
|
- 添加新的 Chatflow 想法
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ Flowise 在一个单一的单体存储库中有 3 个不同的模块。
|
|||||||
|
|
||||||
- `server`:用于提供 API 逻辑的 Node 后端
|
- `server`:用于提供 API 逻辑的 Node 后端
|
||||||
- `ui`:React 前端
|
- `ui`:React 前端
|
||||||
- `components`:Langchain 组件
|
- `components`:Langchain/LlamaIndex 组件
|
||||||
|
|
||||||
#### 先决条件
|
#### 先决条件
|
||||||
|
|
||||||
@@ -123,6 +123,7 @@ Flowise 支持不同的环境变量来配置您的实例。您可以在 `package
|
|||||||
| PORT | Flowise 运行的 HTTP 端口 | 数字 | 3000 |
|
| PORT | Flowise 运行的 HTTP 端口 | 数字 | 3000 |
|
||||||
| FLOWISE_USERNAME | 登录用户名 | 字符串 | |
|
| FLOWISE_USERNAME | 登录用户名 | 字符串 | |
|
||||||
| FLOWISE_PASSWORD | 登录密码 | 字符串 | |
|
| FLOWISE_PASSWORD | 登录密码 | 字符串 | |
|
||||||
|
| FLOWISE_FILE_SIZE_LIMIT | 上传文件大小限制 | 字符串 | 50mb |
|
||||||
| DEBUG | 打印组件的日志 | 布尔值 | |
|
| DEBUG | 打印组件的日志 | 布尔值 | |
|
||||||
| LOG_PATH | 存储日志文件的位置 | 字符串 | `your-path/Flowise/logs` |
|
| LOG_PATH | 存储日志文件的位置 | 字符串 | `your-path/Flowise/logs` |
|
||||||
| LOG_LEVEL | 日志的不同级别 | 枚举字符串: `error`, `info`, `verbose`, `debug` | `info` |
|
| LOG_LEVEL | 日志的不同级别 | 枚举字符串: `error`, `info`, `verbose`, `debug` | `info` |
|
||||||
|
|||||||
+3
-2
@@ -30,7 +30,7 @@ Found an issue? [Report it](https://github.com/FlowiseAI/Flowise/issues/new/choo
|
|||||||
|
|
||||||
Not sure what to contribute? Some ideas:
|
Not sure what to contribute? Some ideas:
|
||||||
|
|
||||||
- Create new components from Langchain
|
- Create new components from `packages/components`
|
||||||
- Update existing components such as extending functionality, fixing bugs
|
- Update existing components such as extending functionality, fixing bugs
|
||||||
- Add new chatflow ideas
|
- Add new chatflow ideas
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ Flowise has 3 different modules in a single mono repository.
|
|||||||
|
|
||||||
- `server`: Node backend to serve API logics
|
- `server`: Node backend to serve API logics
|
||||||
- `ui`: React frontend
|
- `ui`: React frontend
|
||||||
- `components`: Langchain components
|
- `components`: Third-party nodes integrations
|
||||||
|
|
||||||
#### Prerequisite
|
#### Prerequisite
|
||||||
|
|
||||||
@@ -127,6 +127,7 @@ Flowise support different environment variables to configure your instance. You
|
|||||||
| IFRAME_ORIGINS | The allowed origins for iframe src embedding | String | |
|
| IFRAME_ORIGINS | The allowed origins for iframe src embedding | String | |
|
||||||
| FLOWISE_USERNAME | Username to login | String | |
|
| FLOWISE_USERNAME | Username to login | String | |
|
||||||
| FLOWISE_PASSWORD | Password to login | String | |
|
| FLOWISE_PASSWORD | Password to login | String | |
|
||||||
|
| FLOWISE_FILE_SIZE_LIMIT | Upload File Size Limit | String | 50mb |
|
||||||
| DEBUG | Print logs from components | Boolean | |
|
| DEBUG | Print logs from components | Boolean | |
|
||||||
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
|
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
|
||||||
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ Flowise 在一个单一的代码库中有 3 个不同的模块。
|
|||||||
|
|
||||||
- `server`:用于提供 API 逻辑的 Node 后端
|
- `server`:用于提供 API 逻辑的 Node 后端
|
||||||
- `ui`:React 前端
|
- `ui`:React 前端
|
||||||
- `components`:Langchain 组件
|
- `components`:第三方节点集成
|
||||||
|
|
||||||
### 先决条件
|
### 先决条件
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ Flowise has 3 different modules in a single mono repository.
|
|||||||
|
|
||||||
- `server`: Node backend to serve API logics
|
- `server`: Node backend to serve API logics
|
||||||
- `ui`: React frontend
|
- `ui`: React frontend
|
||||||
- `components`: Langchain components
|
- `components`: Third-party nodes integrations
|
||||||
|
|
||||||
### Prerequisite
|
### Prerequisite
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ LOG_PATH=/root/.flowise/logs
|
|||||||
# FLOWISE_USERNAME=user
|
# FLOWISE_USERNAME=user
|
||||||
# FLOWISE_PASSWORD=1234
|
# FLOWISE_PASSWORD=1234
|
||||||
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
|
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
|
||||||
|
# FLOWISE_FILE_SIZE_LIMIT=50mb
|
||||||
# DEBUG=true
|
# DEBUG=true
|
||||||
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
||||||
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
|
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ services:
|
|||||||
- IFRAME_ORIGINS=${IFRAME_ORIGINS}
|
- IFRAME_ORIGINS=${IFRAME_ORIGINS}
|
||||||
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
||||||
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
||||||
|
- FLOWISE_FILE_SIZE_LIMIT=${FLOWISE_FILE_SIZE_LIMIT}
|
||||||
- DEBUG=${DEBUG}
|
- DEBUG=${DEBUG}
|
||||||
- DATABASE_PATH=${DATABASE_PATH}
|
- DATABASE_PATH=${DATABASE_PATH}
|
||||||
- DATABASE_TYPE=${DATABASE_TYPE}
|
- DATABASE_TYPE=${DATABASE_TYPE}
|
||||||
|
|||||||
+9
-9
@@ -1,6 +1,6 @@
|
|||||||
import { INodeParams, INodeCredential } from '../src/Interface'
|
import { INodeParams, INodeCredential } from '../src/Interface'
|
||||||
|
|
||||||
class LLMonitorApi implements INodeCredential {
|
class LunaryApi implements INodeCredential {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
version: number
|
version: number
|
||||||
@@ -8,25 +8,25 @@ class LLMonitorApi implements INodeCredential {
|
|||||||
inputs: INodeParams[]
|
inputs: INodeParams[]
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'LLMonitor API'
|
this.label = 'Lunary API'
|
||||||
this.name = 'llmonitorApi'
|
this.name = 'lunaryApi'
|
||||||
this.version = 1.0
|
this.version = 1.0
|
||||||
this.description = 'Refer to <a target="_blank" href="https://llmonitor.com/docs">official guide</a> to get APP ID'
|
this.description = 'Refer to <a target="_blank" href="https://lunary.ai/docs">official guide</a> to get APP ID'
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
{
|
{
|
||||||
label: 'APP ID',
|
label: 'APP ID',
|
||||||
name: 'llmonitorAppId',
|
name: 'lunaryAppId',
|
||||||
type: 'password',
|
type: 'password',
|
||||||
placeholder: '<LLMonitor_APP_ID>'
|
placeholder: '<Lunary_APP_ID>'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Endpoint',
|
label: 'Endpoint',
|
||||||
name: 'llmonitorEndpoint',
|
name: 'lunaryEndpoint',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'https://app.llmonitor.com'
|
default: 'https://app.lunary.ai'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { credClass: LLMonitorApi }
|
module.exports = { credClass: LunaryApi }
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
|
||||||
import { AgentExecutor } from 'langchain/agents'
|
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
|
||||||
import { LoadPyodide, finalSystemPrompt, systemPrompt } from './core'
|
|
||||||
import { LLMChain } from 'langchain/chains'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { AgentExecutor } from 'langchain/agents'
|
||||||
|
import { LLMChain } from 'langchain/chains'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { LoadPyodide, finalSystemPrompt, systemPrompt } from './core'
|
||||||
|
|
||||||
class Airtable_Agents implements INode {
|
class Airtable_Agents implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
|
||||||
import { AutoGPT } from 'langchain/experimental/autogpt'
|
|
||||||
import { Tool } from 'langchain/tools'
|
|
||||||
import { AIMessage, HumanMessage, SystemMessage } from 'langchain/schema'
|
|
||||||
import { VectorStoreRetriever } from 'langchain/vectorstores/base'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
import { StructuredTool } from 'langchain/tools'
|
import { Tool, StructuredTool } from '@langchain/core/tools'
|
||||||
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
import { AIMessage, HumanMessage, SystemMessage } from '@langchain/core/messages'
|
||||||
|
import { VectorStoreRetriever } from '@langchain/core/vectorstores'
|
||||||
|
import { PromptTemplate } from '@langchain/core/prompts'
|
||||||
|
import { AutoGPT } from 'langchain/experimental/autogpt'
|
||||||
import { LLMChain } from 'langchain/chains'
|
import { LLMChain } from 'langchain/chains'
|
||||||
import { PromptTemplate } from 'langchain/prompts'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
|
||||||
type ObjectTool = StructuredTool
|
type ObjectTool = StructuredTool
|
||||||
const FINISH_NAME = 'finish'
|
const FINISH_NAME = 'finish'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
import { VectorStore } from '@langchain/core/vectorstores'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { BabyAGI } from './core'
|
import { BabyAGI } from './core'
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
|
||||||
import { VectorStore } from 'langchain/vectorstores/base'
|
|
||||||
|
|
||||||
class BabyAGI_Agents implements INode {
|
class BabyAGI_Agents implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
import { VectorStore } from '@langchain/core/vectorstores'
|
||||||
|
import { Document } from '@langchain/core/documents'
|
||||||
|
import { PromptTemplate } from '@langchain/core/prompts'
|
||||||
import { LLMChain } from 'langchain/chains'
|
import { LLMChain } from 'langchain/chains'
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
|
||||||
import { VectorStore } from 'langchain/dist/vectorstores/base'
|
|
||||||
import { Document } from 'langchain/document'
|
|
||||||
import { PromptTemplate } from 'langchain/prompts'
|
|
||||||
|
|
||||||
class TaskCreationChain extends LLMChain {
|
class TaskCreationChain extends LLMChain {
|
||||||
constructor(prompt: PromptTemplate, llm: BaseChatModel) {
|
constructor(prompt: PromptTemplate, llm: BaseChatModel) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
import { AgentExecutor } from 'langchain/agents'
|
import { AgentExecutor } from 'langchain/agents'
|
||||||
|
import { LLMChain } from 'langchain/chains'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { LoadPyodide, finalSystemPrompt, systemPrompt } from './core'
|
import { LoadPyodide, finalSystemPrompt, systemPrompt } from './core'
|
||||||
import { LLMChain } from 'langchain/chains'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
|
|
||||||
class CSV_Agents implements INode {
|
class CSV_Agents implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import { Tool } from 'langchain/tools'
|
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
import { AgentStep, BaseMessage, ChainValues, AIMessage, HumanMessage } from 'langchain/schema'
|
import { Tool } from '@langchain/core/tools'
|
||||||
import { RunnableSequence } from 'langchain/schema/runnable'
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
import { AIMessage, BaseMessage, HumanMessage } from '@langchain/core/messages'
|
||||||
|
import { ChainValues } from '@langchain/core/utils/types'
|
||||||
|
import { AgentStep } from '@langchain/core/agents'
|
||||||
|
import { renderTemplate } from '@langchain/core/prompts'
|
||||||
|
import { RunnableSequence } from '@langchain/core/runnables'
|
||||||
|
import { ChatConversationalAgent } from 'langchain/agents'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { AgentExecutor } from '../../../src/agents'
|
import { AgentExecutor } from '../../../src/agents'
|
||||||
import { ChatConversationalAgent } from 'langchain/agents'
|
|
||||||
import { renderTemplate } from '@langchain/core/prompts'
|
|
||||||
|
|
||||||
const DEFAULT_PREFIX = `Assistant is a large language model trained by OpenAI.
|
const DEFAULT_PREFIX = `Assistant is a large language model trained by OpenAI.
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -1,13 +1,14 @@
|
|||||||
import { ChainValues, AgentStep, BaseMessage } from 'langchain/schema'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
import { ChatOpenAI } from 'langchain/chat_models/openai'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
import { ChatPromptTemplate, MessagesPlaceholder } from 'langchain/prompts'
|
import { ChainValues } from '@langchain/core/utils/types'
|
||||||
import { formatToOpenAIFunction } from 'langchain/tools'
|
import { AgentStep } from '@langchain/core/agents'
|
||||||
import { RunnableSequence } from 'langchain/schema/runnable'
|
import { RunnableSequence } from '@langchain/core/runnables'
|
||||||
|
import { ChatOpenAI, formatToOpenAIFunction } from '@langchain/openai'
|
||||||
|
import { ChatPromptTemplate, MessagesPlaceholder } from '@langchain/core/prompts'
|
||||||
|
import { OpenAIFunctionsAgentOutputParser } from 'langchain/agents/openai/output_parser'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
import { OpenAIFunctionsAgentOutputParser } from 'langchain/agents/openai/output_parser'
|
|
||||||
import { AgentExecutor, formatAgentSteps } from '../../../src/agents'
|
import { AgentExecutor, formatAgentSteps } from '../../../src/agents'
|
||||||
|
|
||||||
const defaultMessage = `Do your best to answer the questions. Feel free to use any tools available to look up relevant information, only if necessary.`
|
const defaultMessage = `Do your best to answer the questions. Feel free to use any tools available to look up relevant information, only if necessary.`
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { initializeAgentExecutorWithOptions, AgentExecutor } from 'langchain/agents'
|
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
|
||||||
import { Tool } from 'langchain/tools'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
|
import { AgentExecutor, createReactAgent } from 'langchain/agents'
|
||||||
|
import { pull } from 'langchain/hub'
|
||||||
|
import { Tool } from '@langchain/core/tools'
|
||||||
|
import type { PromptTemplate } from '@langchain/core/prompts'
|
||||||
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
import { additionalCallbacks } from '../../../src/handler'
|
import { additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
|
||||||
class MRKLAgentChat_Agents implements INode {
|
class MRKLAgentChat_Agents implements INode {
|
||||||
label: string
|
label: string
|
||||||
@@ -20,7 +22,7 @@ class MRKLAgentChat_Agents implements INode {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'ReAct Agent for Chat Models'
|
this.label = 'ReAct Agent for Chat Models'
|
||||||
this.name = 'mrklAgentChat'
|
this.name = 'mrklAgentChat'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.type = 'AgentExecutor'
|
this.type = 'AgentExecutor'
|
||||||
this.category = 'Agents'
|
this.category = 'Agents'
|
||||||
this.icon = 'agent.svg'
|
this.icon = 'agent.svg'
|
||||||
@@ -34,30 +36,42 @@ class MRKLAgentChat_Agents implements INode {
|
|||||||
list: true
|
list: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Language Model',
|
label: 'Chat Model',
|
||||||
name: 'model',
|
name: 'model',
|
||||||
type: 'BaseLanguageModel'
|
type: 'BaseChatModel'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(): Promise<any> {
|
||||||
const model = nodeData.inputs?.model as BaseLanguageModel
|
return null
|
||||||
let tools = nodeData.inputs?.tools as Tool[]
|
|
||||||
tools = flatten(tools)
|
|
||||||
const executor = await initializeAgentExecutorWithOptions(tools, model, {
|
|
||||||
agentType: 'chat-zero-shot-react-description',
|
|
||||||
verbose: process.env.DEBUG === 'true' ? true : false
|
|
||||||
})
|
|
||||||
return executor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
||||||
const executor = nodeData.instance as AgentExecutor
|
const model = nodeData.inputs?.model as BaseChatModel
|
||||||
|
let tools = nodeData.inputs?.tools as Tool[]
|
||||||
|
tools = flatten(tools)
|
||||||
|
|
||||||
|
const promptWithChat = await pull<PromptTemplate>('hwchase17/react-chat')
|
||||||
|
|
||||||
|
const agent = await createReactAgent({
|
||||||
|
llm: model,
|
||||||
|
tools,
|
||||||
|
prompt: promptWithChat
|
||||||
|
})
|
||||||
|
|
||||||
|
const executor = new AgentExecutor({
|
||||||
|
agent,
|
||||||
|
tools,
|
||||||
|
verbose: process.env.DEBUG === 'true' ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
const callbacks = await additionalCallbacks(nodeData, options)
|
const callbacks = await additionalCallbacks(nodeData, options)
|
||||||
|
|
||||||
const result = await executor.call({ input }, [...callbacks])
|
const result = await executor.invoke({
|
||||||
|
input,
|
||||||
|
callbacks
|
||||||
|
})
|
||||||
|
|
||||||
return result?.output
|
return result?.output
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { initializeAgentExecutorWithOptions, AgentExecutor } from 'langchain/agents'
|
|
||||||
import { Tool } from 'langchain/tools'
|
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
|
import { AgentExecutor, createReactAgent } from 'langchain/agents'
|
||||||
|
import { pull } from 'langchain/hub'
|
||||||
|
import { Tool } from '@langchain/core/tools'
|
||||||
|
import type { PromptTemplate } from '@langchain/core/prompts'
|
||||||
|
import { BaseLanguageModel } from 'langchain/base_language'
|
||||||
import { additionalCallbacks } from '../../../src/handler'
|
import { additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
|
||||||
class MRKLAgentLLM_Agents implements INode {
|
class MRKLAgentLLM_Agents implements INode {
|
||||||
label: string
|
label: string
|
||||||
@@ -41,24 +43,35 @@ class MRKLAgentLLM_Agents implements INode {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(): Promise<any> {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
||||||
const model = nodeData.inputs?.model as BaseLanguageModel
|
const model = nodeData.inputs?.model as BaseLanguageModel
|
||||||
let tools = nodeData.inputs?.tools as Tool[]
|
let tools = nodeData.inputs?.tools as Tool[]
|
||||||
tools = flatten(tools)
|
tools = flatten(tools)
|
||||||
|
|
||||||
const executor = await initializeAgentExecutorWithOptions(tools, model, {
|
const prompt = await pull<PromptTemplate>('hwchase17/react')
|
||||||
agentType: 'zero-shot-react-description',
|
|
||||||
|
const agent = await createReactAgent({
|
||||||
|
llm: model,
|
||||||
|
tools,
|
||||||
|
prompt
|
||||||
|
})
|
||||||
|
|
||||||
|
const executor = new AgentExecutor({
|
||||||
|
agent,
|
||||||
|
tools,
|
||||||
verbose: process.env.DEBUG === 'true' ? true : false
|
verbose: process.env.DEBUG === 'true' ? true : false
|
||||||
})
|
})
|
||||||
return executor
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
|
||||||
const executor = nodeData.instance as AgentExecutor
|
|
||||||
|
|
||||||
const callbacks = await additionalCallbacks(nodeData, options)
|
const callbacks = await additionalCallbacks(nodeData, options)
|
||||||
|
|
||||||
const result = await executor.call({ input }, [...callbacks])
|
const result = await executor.invoke({
|
||||||
|
input,
|
||||||
|
callbacks
|
||||||
|
})
|
||||||
|
|
||||||
return result?.output
|
return result?.output
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { ChainValues, AgentStep, BaseMessage } from 'langchain/schema'
|
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
import { RunnableSequence } from 'langchain/schema/runnable'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
import { formatToOpenAIFunction } from 'langchain/tools'
|
import { ChainValues } from '@langchain/core/utils/types'
|
||||||
import { ChatOpenAI } from 'langchain/chat_models/openai'
|
import { AgentStep } from '@langchain/core/agents'
|
||||||
|
import { RunnableSequence } from '@langchain/core/runnables'
|
||||||
|
import { ChatOpenAI, formatToOpenAIFunction } from '@langchain/openai'
|
||||||
|
import { ChatPromptTemplate, MessagesPlaceholder } from '@langchain/core/prompts'
|
||||||
|
import { OpenAIFunctionsAgentOutputParser } from 'langchain/agents/openai/output_parser'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
import { ChatPromptTemplate, MessagesPlaceholder } from 'langchain/prompts'
|
|
||||||
import { OpenAIFunctionsAgentOutputParser } from 'langchain/agents/openai/output_parser'
|
|
||||||
import { AgentExecutor, formatAgentSteps } from '../../../src/agents'
|
import { AgentExecutor, formatAgentSteps } from '../../../src/agents'
|
||||||
|
|
||||||
class OpenAIFunctionAgent_Agents implements INode {
|
class OpenAIFunctionAgent_Agents implements INode {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
+6
-6
@@ -1,6 +1,6 @@
|
|||||||
import { INode, INodeParams } from '../../../src/Interface'
|
import { INode, INodeParams } from '../../../src/Interface'
|
||||||
|
|
||||||
class LLMonitor_Analytic implements INode {
|
class Lunary_Analytic implements INode {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
version: number
|
version: number
|
||||||
@@ -13,10 +13,10 @@ class LLMonitor_Analytic implements INode {
|
|||||||
credential: INodeParams
|
credential: INodeParams
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'LLMonitor'
|
this.label = 'Lunary'
|
||||||
this.name = 'llmonitor'
|
this.name = 'lunary'
|
||||||
this.version = 1.0
|
this.version = 1.0
|
||||||
this.type = 'LLMonitor'
|
this.type = 'Lunary'
|
||||||
this.icon = 'Lunary.svg'
|
this.icon = 'Lunary.svg'
|
||||||
this.category = 'Analytic'
|
this.category = 'Analytic'
|
||||||
this.baseClasses = [this.type]
|
this.baseClasses = [this.type]
|
||||||
@@ -25,9 +25,9 @@ class LLMonitor_Analytic implements INode {
|
|||||||
label: 'Connect Credential',
|
label: 'Connect Credential',
|
||||||
name: 'credential',
|
name: 'credential',
|
||||||
type: 'credential',
|
type: 'credential',
|
||||||
credentialNames: ['llmonitorApi']
|
credentialNames: ['lunaryApi']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { nodeClass: LLMonitor_Analytic }
|
module.exports = { nodeClass: Lunary_Analytic }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getBaseClasses, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import hash from 'object-hash'
|
import hash from 'object-hash'
|
||||||
|
import { getBaseClasses, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
|
|
||||||
class InMemoryCache implements INode {
|
class InMemoryCache implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getBaseClasses, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
import { Embeddings } from '@langchain/core/embeddings'
|
||||||
|
import { BaseStore } from '@langchain/core/stores'
|
||||||
import { CacheBackedEmbeddings } from 'langchain/embeddings/cache_backed'
|
import { CacheBackedEmbeddings } from 'langchain/embeddings/cache_backed'
|
||||||
import { Embeddings } from 'langchain/embeddings/base'
|
import { getBaseClasses, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
import { BaseStore } from 'langchain/schema/storage'
|
|
||||||
|
|
||||||
class InMemoryEmbeddingCache implements INode {
|
class InMemoryEmbeddingCache implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
|
||||||
import { MomentoCache as LangchainMomentoCache } from 'langchain/cache/momento'
|
|
||||||
import { CacheClient, Configurations, CredentialProvider } from '@gomomento/sdk'
|
import { CacheClient, Configurations, CredentialProvider } from '@gomomento/sdk'
|
||||||
|
import { MomentoCache as LangchainMomentoCache } from '@langchain/community/caches/momento'
|
||||||
|
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
|
|
||||||
class MomentoCache implements INode {
|
class MomentoCache implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
|
||||||
import { RedisCache as LangchainRedisCache } from 'langchain/cache/ioredis'
|
|
||||||
import { Redis, RedisOptions } from 'ioredis'
|
import { Redis, RedisOptions } from 'ioredis'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { Generation, ChatGeneration, StoredGeneration, mapStoredMessageToChatMessage } from 'langchain/schema'
|
|
||||||
import hash from 'object-hash'
|
import hash from 'object-hash'
|
||||||
|
import { RedisCache as LangchainRedisCache } from '@langchain/community/caches/ioredis'
|
||||||
|
import { StoredGeneration, mapStoredMessageToChatMessage } from '@langchain/core/messages'
|
||||||
|
import { Generation, ChatGeneration } from '@langchain/core/outputs'
|
||||||
|
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
|
|
||||||
let redisClientSingleton: Redis
|
let redisClientSingleton: Redis
|
||||||
let redisClientOption: RedisOptions
|
let redisClientOption: RedisOptions
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
|
||||||
import { Redis, RedisOptions } from 'ioredis'
|
import { Redis, RedisOptions } from 'ioredis'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
|
import { RedisByteStore } from '@langchain/community/storage/ioredis'
|
||||||
|
import { Embeddings } from '@langchain/core/embeddings'
|
||||||
import { CacheBackedEmbeddings } from 'langchain/embeddings/cache_backed'
|
import { CacheBackedEmbeddings } from 'langchain/embeddings/cache_backed'
|
||||||
import { RedisByteStore } from 'langchain/storage/ioredis'
|
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
import { Embeddings } from 'langchain/embeddings/base'
|
|
||||||
|
|
||||||
let redisClientSingleton: Redis
|
let redisClientSingleton: Redis
|
||||||
let redisClientOption: RedisOptions
|
let redisClientOption: RedisOptions
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { UpstashRedisCache as LangchainUpstashRedisCache } from '@langchain/community/caches/upstash_redis'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
|
||||||
import { UpstashRedisCache as LangchainUpstashRedisCache } from 'langchain/cache/upstash_redis'
|
|
||||||
|
|
||||||
class UpstashRedisCache implements INode {
|
class UpstashRedisCache implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { PromptTemplate } from '@langchain/core/prompts'
|
||||||
import { APIChain } from 'langchain/chains'
|
import { APIChain } from 'langchain/chains'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { PromptTemplate } from 'langchain/prompts'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
|
||||||
export const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
|
export const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ChatOpenAI } from '@langchain/openai'
|
||||||
import { APIChain, createOpenAPIChain } from 'langchain/chains'
|
import { APIChain, createOpenAPIChain } from 'langchain/chains'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { ChatOpenAI } from 'langchain/chat_models/openai'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
|
||||||
class OpenApiChain_Chains implements INode {
|
class OpenApiChain_Chains implements INode {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { PromptTemplate } from '@langchain/core/prompts'
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { PromptTemplate } from 'langchain/prompts'
|
|
||||||
import { API_RESPONSE_RAW_PROMPT_TEMPLATE, API_URL_RAW_PROMPT_TEMPLATE, APIChain } from './postCore'
|
import { API_RESPONSE_RAW_PROMPT_TEMPLATE, API_URL_RAW_PROMPT_TEMPLATE, APIChain } from './postCore'
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
|
||||||
class POSTApiChain_Chains implements INode {
|
class POSTApiChain_Chains implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
import { CallbackManagerForChainRun } from 'langchain/callbacks'
|
import { CallbackManagerForChainRun } from '@langchain/core/callbacks/manager'
|
||||||
import { BaseChain, ChainInputs, LLMChain, SerializedAPIChain } from 'langchain/chains'
|
import { BaseChain, ChainInputs, LLMChain, SerializedAPIChain } from 'langchain/chains'
|
||||||
import { BasePromptTemplate, PromptTemplate } from 'langchain/prompts'
|
import { BasePromptTemplate, PromptTemplate } from '@langchain/core/prompts'
|
||||||
import { ChainValues } from 'langchain/schema'
|
import { ChainValues } from '@langchain/core/utils/types'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
|
|
||||||
export const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
|
export const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate } from '@langchain/core/prompts'
|
||||||
import { ConversationChain } from 'langchain/chains'
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils'
|
import { RunnableSequence } from '@langchain/core/runnables'
|
||||||
import { ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate } from 'langchain/prompts'
|
import { StringOutputParser } from '@langchain/core/output_parsers'
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
import { RunnableSequence } from 'langchain/schema/runnable'
|
|
||||||
import { StringOutputParser } from 'langchain/schema/output_parser'
|
|
||||||
import { ConsoleCallbackHandler as LCConsoleCallbackHandler } from '@langchain/core/tracers/console'
|
import { ConsoleCallbackHandler as LCConsoleCallbackHandler } from '@langchain/core/tracers/console'
|
||||||
|
import { ConversationChain } from 'langchain/chains'
|
||||||
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils'
|
||||||
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
|
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
|
||||||
import { formatResponse } from '../../outputparsers/OutputParserHelpers'
|
import { formatResponse } from '../../outputparsers/OutputParserHelpers'
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -1,19 +1,18 @@
|
|||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { ConversationalRetrievalQAChain } from 'langchain/chains'
|
|
||||||
import { BaseRetriever } from 'langchain/schema/retriever'
|
|
||||||
import { BufferMemoryInput } from 'langchain/memory'
|
|
||||||
import { PromptTemplate } from 'langchain/prompts'
|
|
||||||
import { QA_TEMPLATE, REPHRASE_TEMPLATE, RESPONSE_TEMPLATE } from './prompts'
|
|
||||||
import { Runnable, RunnableSequence, RunnableMap, RunnableBranch, RunnableLambda } from 'langchain/schema/runnable'
|
|
||||||
import { BaseMessage, HumanMessage, AIMessage } from 'langchain/schema'
|
|
||||||
import { StringOutputParser } from 'langchain/schema/output_parser'
|
|
||||||
import type { Document } from 'langchain/document'
|
|
||||||
import { ChatPromptTemplate, MessagesPlaceholder } from 'langchain/prompts'
|
|
||||||
import { applyPatch } from 'fast-json-patch'
|
import { applyPatch } from 'fast-json-patch'
|
||||||
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { BaseRetriever } from '@langchain/core/retrievers'
|
||||||
|
import { PromptTemplate, ChatPromptTemplate, MessagesPlaceholder } from '@langchain/core/prompts'
|
||||||
|
import { Runnable, RunnableSequence, RunnableMap, RunnableBranch, RunnableLambda } from '@langchain/core/runnables'
|
||||||
|
import { BaseMessage, HumanMessage, AIMessage } from '@langchain/core/messages'
|
||||||
|
import { ConsoleCallbackHandler as LCConsoleCallbackHandler } from '@langchain/core/tracers/console'
|
||||||
|
import { StringOutputParser } from '@langchain/core/output_parsers'
|
||||||
|
import type { Document } from '@langchain/core/documents'
|
||||||
|
import { BufferMemoryInput } from 'langchain/memory'
|
||||||
|
import { ConversationalRetrievalQAChain } from 'langchain/chains'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
||||||
import { ConsoleCallbackHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
||||||
import { ConsoleCallbackHandler as LCConsoleCallbackHandler } from '@langchain/core/tracers/console'
|
import { QA_TEMPLATE, REPHRASE_TEMPLATE, RESPONSE_TEMPLATE } from './prompts'
|
||||||
|
|
||||||
type RetrievalChainInput = {
|
type RetrievalChainInput = {
|
||||||
chat_history: string
|
chat_history: string
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
import { BaseLanguageModel, BaseLanguageModelCallOptions } from '@langchain/core/language_models/base'
|
||||||
import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils'
|
import { BaseLLMOutputParser, BaseOutputParser } from '@langchain/core/output_parsers'
|
||||||
import { LLMChain } from 'langchain/chains'
|
|
||||||
import { BaseLanguageModel, BaseLanguageModelCallOptions } from 'langchain/base_language'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
import { BaseOutputParser } from 'langchain/schema/output_parser'
|
|
||||||
import { formatResponse, injectOutputParser } from '../../outputparsers/OutputParserHelpers'
|
|
||||||
import { BaseLLMOutputParser } from 'langchain/schema/output_parser'
|
|
||||||
import { OutputFixingParser } from 'langchain/output_parsers'
|
import { OutputFixingParser } from 'langchain/output_parsers'
|
||||||
|
import { LLMChain } from 'langchain/chains'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils'
|
||||||
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
|
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
|
||||||
|
import { formatResponse, injectOutputParser } from '../../outputparsers/OutputParserHelpers'
|
||||||
|
|
||||||
class LLMChain_Chains implements INode {
|
class LLMChain_Chains implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { MultiPromptChain } from 'langchain/chains'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams, PromptRetriever } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams, PromptRetriever } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { MultiPromptChain } from 'langchain/chains'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
|
||||||
class MultiPromptChain_Chains implements INode {
|
class MultiPromptChain_Chains implements INode {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { MultiRetrievalQAChain } from 'langchain/chains'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams, VectorStoreRetriever } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams, VectorStoreRetriever } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { MultiRetrievalQAChain } from 'langchain/chains'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
|
||||||
class MultiRetrievalQAChain_Chains implements INode {
|
class MultiRetrievalQAChain_Chains implements INode {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { BaseRetriever } from '@langchain/core/retrievers'
|
||||||
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
import { RetrievalQAChain } from 'langchain/chains'
|
import { RetrievalQAChain } from 'langchain/chains'
|
||||||
import { BaseRetriever } from 'langchain/schema/retriever'
|
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
|
||||||
class RetrievalQAChain_Chains implements INode {
|
class RetrievalQAChain_Chains implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { SqlDatabaseChain, SqlDatabaseChainInput, DEFAULT_SQL_DATABASE_PROMPT } from 'langchain/chains/sql_db'
|
|
||||||
import { getBaseClasses, getInputVariables } from '../../../src/utils'
|
|
||||||
import { DataSource } from 'typeorm'
|
|
||||||
import { SqlDatabase } from 'langchain/sql_db'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { PromptTemplate, PromptTemplateInput } from 'langchain/prompts'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
import { DataSourceOptions } from 'typeorm/data-source'
|
import { DataSourceOptions } from 'typeorm/data-source'
|
||||||
|
import { DataSource } from 'typeorm'
|
||||||
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { PromptTemplate, PromptTemplateInput } from '@langchain/core/prompts'
|
||||||
|
import { SqlDatabaseChain, SqlDatabaseChainInput, DEFAULT_SQL_DATABASE_PROMPT } from 'langchain/chains/sql_db'
|
||||||
|
import { SqlDatabase } from 'langchain/sql_db'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
|
import { getBaseClasses, getInputVariables } from '../../../src/utils'
|
||||||
|
|
||||||
type DatabaseType = 'sqlite' | 'postgres' | 'mssql' | 'mysql'
|
type DatabaseType = 'sqlite' | 'postgres' | 'mssql' | 'mysql'
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import fetch from 'node-fetch'
|
||||||
|
import { Document } from '@langchain/core/documents'
|
||||||
|
import { VectaraStore } from '@langchain/community/vectorstores/vectara'
|
||||||
|
import { VectorDBQAChain } from 'langchain/chains'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { VectorDBQAChain } from 'langchain/chains'
|
|
||||||
import { Document } from 'langchain/document'
|
|
||||||
import { VectaraStore } from 'langchain/vectorstores/vectara'
|
|
||||||
import fetch from 'node-fetch'
|
|
||||||
|
|
||||||
// functionality based on https://github.com/vectara/vectara-answer
|
// functionality based on https://github.com/vectara/vectara-answer
|
||||||
const reorderCitations = (unorderedSummary: string) => {
|
const reorderCitations = (unorderedSummary: string) => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||||
|
import { VectorStore } from '@langchain/core/vectorstores'
|
||||||
|
import { VectorDBQAChain } from 'langchain/chains'
|
||||||
|
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { VectorDBQAChain } from 'langchain/chains'
|
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
|
||||||
import { VectorStore } from 'langchain/vectorstores/base'
|
|
||||||
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
|
|
||||||
|
|
||||||
class VectorDBQAChain_Chains implements INode {
|
class VectorDBQAChain_Chains implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { BedrockChat } from '@langchain/community/chat_models/bedrock'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseChatModelParams } from '@langchain/core/language_models/chat_models'
|
||||||
|
import { BaseBedrockInput } from 'langchain/dist/util/bedrock'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { BedrockChat } from 'langchain/chat_models/bedrock'
|
|
||||||
import { BaseBedrockInput } from 'langchain/dist/util/bedrock'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseChatModelParams } from 'langchain/chat_models/base'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I had to run the following to build the component
|
* I had to run the following to build the component
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { AzureOpenAIInput, ChatOpenAI, OpenAIChatInput } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { AzureOpenAIInput, ChatOpenAI, OpenAIChatInput } from 'langchain/chat_models/openai'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class AzureChatOpenAI_ChatModels implements INode {
|
class AzureChatOpenAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { NIBittensorChatModel, BittensorInput } from 'langchain/experimental/chat_models/bittensor'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { NIBittensorChatModel, BittensorInput } from 'langchain/experimental/chat_models/bittensor'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class Bittensor_ChatModels implements INode {
|
class Bittensor_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { AnthropicInput, ChatAnthropic } from '@langchain/anthropic'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { AnthropicInput, ChatAnthropic } from 'langchain/chat_models/anthropic'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class ChatAnthropic_ChatModels implements INode {
|
class ChatAnthropic_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from '@langchain/google-genai'
|
|
||||||
import { HarmBlockThreshold, HarmCategory } from '@google/generative-ai'
|
import { HarmBlockThreshold, HarmCategory } from '@google/generative-ai'
|
||||||
import type { SafetySetting } from '@google/generative-ai'
|
import type { SafetySetting } from '@google/generative-ai'
|
||||||
|
import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from '@langchain/google-genai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
|
|
||||||
class GoogleGenerativeAI_ChatModels implements INode {
|
class GoogleGenerativeAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { ChatGooglePaLM, GooglePaLMChatInput } from '@langchain/community/chat_models/googlepalm'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { ChatGooglePaLM, GooglePaLMChatInput } from 'langchain/chat_models/googlepalm'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class ChatGooglePaLM_ChatModels implements INode {
|
class ChatGooglePaLM_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { GoogleAuthOptions } from 'google-auth-library'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { ChatGoogleVertexAI, GoogleVertexAIChatInput } from '@langchain/community/chat_models/googlevertexai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { ChatGoogleVertexAI, GoogleVertexAIChatInput } from 'langchain/chat_models/googlevertexai'
|
|
||||||
import { GoogleAuthOptions } from 'google-auth-library'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class GoogleVertexAI_ChatModels implements INode {
|
class GoogleVertexAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { HFInput, HuggingFaceInference } from './core'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { HFInput, HuggingFaceInference } from './core'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class ChatHuggingFace_ChatModels implements INode {
|
class ChatHuggingFace_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { LLM, BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { getEnvironmentVariable } from '../../../src/utils'
|
import { getEnvironmentVariable } from '../../../src/utils'
|
||||||
import { LLM, BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
export interface HFInput {
|
export interface HFInput {
|
||||||
/** Model to use */
|
/** Model to use */
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
|
import { OpenAIChatInput, ChatOpenAI } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAIChat } from 'langchain/llms/openai'
|
|
||||||
import { OpenAIChatInput } from 'langchain/chat_models/openai'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class ChatLocalAI_ChatModels implements INode {
|
class ChatLocalAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
@@ -25,7 +24,7 @@ class ChatLocalAI_ChatModels implements INode {
|
|||||||
this.icon = 'localai.png'
|
this.icon = 'localai.png'
|
||||||
this.category = 'Chat Models'
|
this.category = 'Chat Models'
|
||||||
this.description = 'Use local LLMs like llama.cpp, gpt4all using LocalAI'
|
this.description = 'Use local LLMs like llama.cpp, gpt4all using LocalAI'
|
||||||
this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(OpenAIChat)]
|
this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(ChatOpenAI)]
|
||||||
this.credential = {
|
this.credential = {
|
||||||
label: 'Connect Credential',
|
label: 'Connect Credential',
|
||||||
name: 'credential',
|
name: 'credential',
|
||||||
@@ -111,7 +110,7 @@ class ChatLocalAI_ChatModels implements INode {
|
|||||||
if (cache) obj.cache = cache
|
if (cache) obj.cache = cache
|
||||||
if (localAIApiKey) obj.openAIApiKey = localAIApiKey
|
if (localAIApiKey) obj.openAIApiKey = localAIApiKey
|
||||||
|
|
||||||
const model = new OpenAIChat(obj, { basePath })
|
const model = new ChatOpenAI(obj, { basePath })
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { ChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { ChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai'
|
|
||||||
|
|
||||||
class ChatMistral_ChatModels implements INode {
|
class ChatMistral_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { ChatOllama, ChatOllamaInput } from '@langchain/community/chat_models/ollama'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { ChatOllama, ChatOllamaInput } from 'langchain/chat_models/ollama'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class ChatOllama_ChatModels implements INode {
|
class ChatOllama_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { ChatOpenAI, OpenAIChatInput } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { ChatOpenAI, OpenAIChatInput } from 'langchain/chat_models/openai'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class ChatOpenAI_ChatModels implements INode {
|
class ChatOpenAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
@@ -59,6 +59,10 @@ class ChatOpenAI_ChatModels implements INode {
|
|||||||
label: 'gpt-4-1106-preview',
|
label: 'gpt-4-1106-preview',
|
||||||
name: 'gpt-4-1106-preview'
|
name: 'gpt-4-1106-preview'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'gpt-4-1106-vision-preview',
|
||||||
|
name: 'gpt-4-1106-vision-preview'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'gpt-4-vision-preview',
|
label: 'gpt-4-vision-preview',
|
||||||
name: 'gpt-4-vision-preview'
|
name: 'gpt-4-vision-preview'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { ChatOpenAI, OpenAIChatInput } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { ChatOpenAI, OpenAIChatInput } from 'langchain/chat_models/openai'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class ChatOpenAICustom_ChatModels implements INode {
|
class ChatOpenAICustom_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import axios, { AxiosRequestConfig } from 'axios'
|
||||||
|
import { Document } from '@langchain/core/documents'
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
import { BaseDocumentLoader } from 'langchain/document_loaders/base'
|
import { BaseDocumentLoader } from 'langchain/document_loaders/base'
|
||||||
import { Document } from 'langchain/document'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import axios, { AxiosRequestConfig } from 'axios'
|
|
||||||
|
|
||||||
class API_DocumentLoaders implements INode {
|
class API_DocumentLoaders implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import axios from 'axios'
|
||||||
|
import { Document } from '@langchain/core/documents'
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
import { BaseDocumentLoader } from 'langchain/document_loaders/base'
|
import { BaseDocumentLoader } from 'langchain/document_loaders/base'
|
||||||
import { Document } from 'langchain/document'
|
|
||||||
import axios from 'axios'
|
|
||||||
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
|
||||||
class Airtable_DocumentLoaders implements INode {
|
class Airtable_DocumentLoaders implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { INode, INodeData, INodeParams, ICommonObject } from '../../../src/Inter
|
|||||||
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
import { ApifyDatasetLoader } from 'langchain/document_loaders/web/apify_dataset'
|
import { ApifyDatasetLoader } from 'langchain/document_loaders/web/apify_dataset'
|
||||||
import { Document } from 'langchain/document'
|
import { Document } from '@langchain/core/documents'
|
||||||
|
|
||||||
class ApifyWebsiteContentCrawler_DocumentLoaders implements INode {
|
class ApifyWebsiteContentCrawler_DocumentLoaders implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -126,7 +126,9 @@ class Cheerio_DocumentLoaders implements INode {
|
|||||||
let docs = []
|
let docs = []
|
||||||
if (relativeLinksMethod) {
|
if (relativeLinksMethod) {
|
||||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||||
if (!limit) limit = 10
|
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||||
|
// so when limit is 0 we can fetch all the links
|
||||||
|
if (limit === null || limit === undefined) limit = 10
|
||||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||||
const pages: string[] =
|
const pages: string[] =
|
||||||
selectedLinks && selectedLinks.length > 0
|
selectedLinks && selectedLinks.length > 0
|
||||||
@@ -143,7 +145,7 @@ class Cheerio_DocumentLoaders implements INode {
|
|||||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||||
if (process.env.DEBUG === 'true')
|
if (process.env.DEBUG === 'true')
|
||||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||||
for (const page of selectedLinks) {
|
for (const page of selectedLinks.slice(0, limit)) {
|
||||||
docs.push(...(await cheerioLoader(page)))
|
docs.push(...(await cheerioLoader(page)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
import { Document } from 'langchain/document'
|
import { Document } from '@langchain/core/documents'
|
||||||
import { handleEscapeCharacters } from '../../../src'
|
import { handleEscapeCharacters } from '../../../src'
|
||||||
|
|
||||||
class PlainText_DocumentLoaders implements INode {
|
class PlainText_DocumentLoaders implements INode {
|
||||||
|
|||||||
@@ -167,7 +167,9 @@ class Playwright_DocumentLoaders implements INode {
|
|||||||
let docs = []
|
let docs = []
|
||||||
if (relativeLinksMethod) {
|
if (relativeLinksMethod) {
|
||||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||||
if (!limit) limit = 10
|
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||||
|
// so when limit is 0 we can fetch all the links
|
||||||
|
if (limit === null || limit === undefined) limit = 10
|
||||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||||
const pages: string[] =
|
const pages: string[] =
|
||||||
selectedLinks && selectedLinks.length > 0
|
selectedLinks && selectedLinks.length > 0
|
||||||
@@ -184,7 +186,7 @@ class Playwright_DocumentLoaders implements INode {
|
|||||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||||
if (process.env.DEBUG === 'true')
|
if (process.env.DEBUG === 'true')
|
||||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||||
for (const page of selectedLinks) {
|
for (const page of selectedLinks.slice(0, limit)) {
|
||||||
docs.push(...(await playwrightLoader(page)))
|
docs.push(...(await playwrightLoader(page)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -168,7 +168,9 @@ class Puppeteer_DocumentLoaders implements INode {
|
|||||||
let docs = []
|
let docs = []
|
||||||
if (relativeLinksMethod) {
|
if (relativeLinksMethod) {
|
||||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||||
if (!limit) limit = 10
|
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||||
|
// so when limit is 0 we can fetch all the links
|
||||||
|
if (limit === null || limit === undefined) limit = 10
|
||||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||||
const pages: string[] =
|
const pages: string[] =
|
||||||
selectedLinks && selectedLinks.length > 0
|
selectedLinks && selectedLinks.length > 0
|
||||||
@@ -185,7 +187,7 @@ class Puppeteer_DocumentLoaders implements INode {
|
|||||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||||
if (process.env.DEBUG === 'true')
|
if (process.env.DEBUG === 'true')
|
||||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||||
for (const page of selectedLinks) {
|
for (const page of selectedLinks.slice(0, limit)) {
|
||||||
docs.push(...(await puppeteerLoader(page)))
|
docs.push(...(await puppeteerLoader(page)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
|
||||||
import { SRTLoader } from 'langchain/document_loaders/fs/srt'
|
|
||||||
|
|
||||||
class Subtitles_DocumentLoaders implements INode {
|
|
||||||
label: string
|
|
||||||
name: string
|
|
||||||
version: number
|
|
||||||
description: string
|
|
||||||
type: string
|
|
||||||
icon: string
|
|
||||||
category: string
|
|
||||||
baseClasses: string[]
|
|
||||||
inputs: INodeParams[]
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.label = 'Subtitles File'
|
|
||||||
this.name = 'subtitlesFile'
|
|
||||||
this.version = 1.0
|
|
||||||
this.type = 'Document'
|
|
||||||
this.icon = 'subtitlesFile.svg'
|
|
||||||
this.category = 'Document Loaders'
|
|
||||||
this.description = `Load data from subtitles files`
|
|
||||||
this.baseClasses = [this.type]
|
|
||||||
this.inputs = [
|
|
||||||
{
|
|
||||||
label: 'Subtitles File',
|
|
||||||
name: 'subtitlesFile',
|
|
||||||
type: 'file',
|
|
||||||
fileType: '.srt'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Text Splitter',
|
|
||||||
name: 'textSplitter',
|
|
||||||
type: 'TextSplitter',
|
|
||||||
optional: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Metadata',
|
|
||||||
name: 'metadata',
|
|
||||||
type: 'json',
|
|
||||||
optional: true,
|
|
||||||
additionalParams: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
|
||||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
|
||||||
const subtitlesFileBase64 = nodeData.inputs?.subtitlesFile as string
|
|
||||||
const metadata = nodeData.inputs?.metadata
|
|
||||||
|
|
||||||
let alldocs = []
|
|
||||||
let files: string[] = []
|
|
||||||
|
|
||||||
if (subtitlesFileBase64.startsWith('[') && subtitlesFileBase64.endsWith(']')) {
|
|
||||||
files = JSON.parse(subtitlesFileBase64)
|
|
||||||
} else {
|
|
||||||
files = [subtitlesFileBase64]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const file of files) {
|
|
||||||
const splitDataURI = file.split(',')
|
|
||||||
splitDataURI.pop()
|
|
||||||
const bf = Buffer.from(splitDataURI.pop() || '', 'base64')
|
|
||||||
const blob = new Blob([bf])
|
|
||||||
const loader = new SRTLoader(blob)
|
|
||||||
|
|
||||||
if (textSplitter) {
|
|
||||||
const docs = await loader.loadAndSplit(textSplitter)
|
|
||||||
alldocs.push(...docs)
|
|
||||||
} else {
|
|
||||||
const docs = await loader.load()
|
|
||||||
alldocs.push(...docs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (metadata) {
|
|
||||||
const parsedMetadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
|
|
||||||
let finaldocs = []
|
|
||||||
for (const doc of alldocs) {
|
|
||||||
const newdoc = {
|
|
||||||
...doc,
|
|
||||||
metadata: {
|
|
||||||
...doc.metadata,
|
|
||||||
...parsedMetadata
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finaldocs.push(newdoc)
|
|
||||||
}
|
|
||||||
return finaldocs
|
|
||||||
}
|
|
||||||
return alldocs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { nodeClass: Subtitles_DocumentLoaders }
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M10.01 20.45C9.01153 19.7553 6 19.6248 6 21.8374C6 24.288 10.5 22.6248 10.5 25.2074C10.5 27.1484 7.49621 27.766 6 26.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<path d="M24.5 27V20M22 20H27" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<path d="M18 5H9C7.89543 5 7 5.89543 7 7V15M18 5L25 12M18 5V12H25M25 12V15" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<path d="M14 27V20H17C18.1046 20 19 20.8954 19 22C19 23.1046 18.1046 24 17 24M17 24H14M17 24L19 27" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 763 B |
@@ -1,7 +1,7 @@
|
|||||||
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||||
import { TextSplitter } from 'langchain/text_splitter'
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
import { TextLoader } from 'langchain/document_loaders/fs/text'
|
import { TextLoader } from 'langchain/document_loaders/fs/text'
|
||||||
import { Document } from 'langchain/document'
|
import { Document } from '@langchain/core/documents'
|
||||||
import { handleEscapeCharacters } from '../../../src'
|
import { handleEscapeCharacters } from '../../../src'
|
||||||
|
|
||||||
class Text_DocumentLoaders implements INode {
|
class Text_DocumentLoaders implements INode {
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { VectorStore } from 'langchain/vectorstores/base'
|
import { VectorStore } from '@langchain/core/vectorstores'
|
||||||
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||||
import { handleEscapeCharacters } from '../../../src/utils'
|
import { handleEscapeCharacters } from '../../../src/utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BedrockRuntimeClient, InvokeModelCommand } from '@aws-sdk/client-bedrock-runtime'
|
||||||
|
import { BedrockEmbeddings, BedrockEmbeddingsParams } from '@langchain/community/embeddings/bedrock'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { BedrockEmbeddings, BedrockEmbeddingsParams } from 'langchain/embeddings/bedrock'
|
|
||||||
import { BedrockRuntimeClient, InvokeModelCommand } from '@aws-sdk/client-bedrock-runtime'
|
|
||||||
|
|
||||||
class AWSBedrockEmbedding_Embeddings implements INode {
|
class AWSBedrockEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { AzureOpenAIInput } from 'langchain/chat_models/openai'
|
import { AzureOpenAIInput, OpenAIEmbeddings, OpenAIEmbeddingsParams } from '@langchain/openai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
|
|
||||||
|
|
||||||
class AzureOpenAIEmbedding_Embeddings implements INode {
|
class AzureOpenAIEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { CohereEmbeddings, CohereEmbeddingsParams } from '@langchain/cohere'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { CohereEmbeddings, CohereEmbeddingsParams } from 'langchain/embeddings/cohere'
|
|
||||||
|
|
||||||
class CohereEmbedding_Embeddings implements INode {
|
class CohereEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
@@ -64,7 +64,7 @@ class CohereEmbedding_Embeddings implements INode {
|
|||||||
apiKey: cohereApiKey
|
apiKey: cohereApiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelName) obj.modelName = modelName
|
if (modelName) obj.model = modelName
|
||||||
|
|
||||||
const model = new CohereEmbeddings(obj)
|
const model = new CohereEmbeddings(obj)
|
||||||
return model
|
return model
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { GooglePaLMEmbeddings, GooglePaLMEmbeddingsParams } from '@langchain/community/embeddings/googlepalm'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { GooglePaLMEmbeddings, GooglePaLMEmbeddingsParams } from 'langchain/embeddings/googlepalm'
|
|
||||||
|
|
||||||
class GooglePaLMEmbedding_Embeddings implements INode {
|
class GooglePaLMEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams } from 'langchain/embeddings/googlevertexai'
|
import { GoogleAuthOptions } from 'google-auth-library'
|
||||||
|
import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams } from '@langchain/community/embeddings/googlevertexai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { GoogleAuthOptions } from 'google-auth-library'
|
|
||||||
|
|
||||||
class GoogleVertexAIEmbedding_Embeddings implements INode {
|
class GoogleVertexAIEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { HfInference } from '@huggingface/inference'
|
import { HfInference } from '@huggingface/inference'
|
||||||
import { Embeddings, EmbeddingsParams } from 'langchain/embeddings/base'
|
import { Embeddings, EmbeddingsParams } from '@langchain/core/embeddings'
|
||||||
import { getEnvironmentVariable } from '../../../src/utils'
|
import { getEnvironmentVariable } from '../../../src/utils'
|
||||||
|
|
||||||
export interface HuggingFaceInferenceEmbeddingsParams extends EmbeddingsParams {
|
export interface HuggingFaceInferenceEmbeddingsParams extends EmbeddingsParams {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from '@langchain/openai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
|
|
||||||
|
|
||||||
class LocalAIEmbedding_Embeddings implements INode {
|
class LocalAIEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { MistralAIEmbeddings, MistralAIEmbeddingsParams } from '@langchain/mistralai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { MistralAIEmbeddings, MistralAIEmbeddingsParams } from '@langchain/mistralai'
|
|
||||||
|
|
||||||
class MistralEmbedding_Embeddings implements INode {
|
class MistralEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { OllamaEmbeddings } from '@langchain/community/embeddings/ollama'
|
||||||
|
import { OllamaInput } from 'langchain/llms/ollama'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { OllamaInput } from 'langchain/llms/ollama'
|
|
||||||
import { OllamaEmbeddings } from 'langchain/embeddings/ollama'
|
|
||||||
|
|
||||||
class OllamaEmbedding_Embeddings implements INode {
|
class OllamaEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from '@langchain/openai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
|
|
||||||
|
|
||||||
class OpenAIEmbedding_Embeddings implements INode {
|
class OpenAIEmbedding_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from '@langchain/openai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
|
|
||||||
|
|
||||||
class OpenAIEmbeddingCustom_Embeddings implements INode {
|
class OpenAIEmbeddingCustom_Embeddings implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ class QueryEngine_LlamaIndex implements INode {
|
|||||||
constructor(fields?: { sessionId?: string }) {
|
constructor(fields?: { sessionId?: string }) {
|
||||||
this.label = 'Query Engine'
|
this.label = 'Query Engine'
|
||||||
this.name = 'queryEngine'
|
this.name = 'queryEngine'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.type = 'QueryEngine'
|
this.type = 'QueryEngine'
|
||||||
this.icon = 'query-engine.png'
|
this.icon = 'query-engine.png'
|
||||||
this.category = 'Engine'
|
this.category = 'Engine'
|
||||||
this.description = 'Simple query engine built to answer question over your data, without memory'
|
this.description = 'Simple query engine built to answer question over your data, without memory'
|
||||||
this.baseClasses = [this.type]
|
this.baseClasses = [this.type, 'BaseQueryEngine']
|
||||||
this.tags = ['LlamaIndex']
|
this.tags = ['LlamaIndex']
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
{
|
{
|
||||||
@@ -59,52 +59,13 @@ class QueryEngine_LlamaIndex implements INode {
|
|||||||
this.sessionId = fields?.sessionId
|
this.sessionId = fields?.sessionId
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
return null
|
return prepareEngine(nodeData)
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string | object> {
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string | object> {
|
||||||
const returnSourceDocuments = nodeData.inputs?.returnSourceDocuments as boolean
|
const returnSourceDocuments = nodeData.inputs?.returnSourceDocuments as boolean
|
||||||
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever
|
const queryEngine = prepareEngine(nodeData)
|
||||||
const responseSynthesizerObj = nodeData.inputs?.responseSynthesizer
|
|
||||||
|
|
||||||
let queryEngine = new RetrieverQueryEngine(vectorStoreRetriever)
|
|
||||||
|
|
||||||
if (responseSynthesizerObj) {
|
|
||||||
if (responseSynthesizerObj.type === 'TreeSummarize') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new TreeSummarize(vectorStoreRetriever.serviceContext, responseSynthesizerObj.textQAPromptTemplate),
|
|
||||||
serviceContext: vectorStoreRetriever.serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
|
||||||
} else if (responseSynthesizerObj.type === 'CompactAndRefine') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new CompactAndRefine(
|
|
||||||
vectorStoreRetriever.serviceContext,
|
|
||||||
responseSynthesizerObj.textQAPromptTemplate,
|
|
||||||
responseSynthesizerObj.refinePromptTemplate
|
|
||||||
),
|
|
||||||
serviceContext: vectorStoreRetriever.serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
|
||||||
} else if (responseSynthesizerObj.type === 'Refine') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new Refine(
|
|
||||||
vectorStoreRetriever.serviceContext,
|
|
||||||
responseSynthesizerObj.textQAPromptTemplate,
|
|
||||||
responseSynthesizerObj.refinePromptTemplate
|
|
||||||
),
|
|
||||||
serviceContext: vectorStoreRetriever.serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
|
||||||
} else if (responseSynthesizerObj.type === 'SimpleResponseBuilder') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new SimpleResponseBuilder(vectorStoreRetriever.serviceContext),
|
|
||||||
serviceContext: vectorStoreRetriever.serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = ''
|
let text = ''
|
||||||
let sourceDocuments: ICommonObject[] = []
|
let sourceDocuments: ICommonObject[] = []
|
||||||
@@ -140,4 +101,49 @@ class QueryEngine_LlamaIndex implements INode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const prepareEngine = (nodeData: INodeData) => {
|
||||||
|
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever
|
||||||
|
const responseSynthesizerObj = nodeData.inputs?.responseSynthesizer
|
||||||
|
|
||||||
|
let queryEngine = new RetrieverQueryEngine(vectorStoreRetriever)
|
||||||
|
|
||||||
|
if (responseSynthesizerObj) {
|
||||||
|
if (responseSynthesizerObj.type === 'TreeSummarize') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new TreeSummarize(vectorStoreRetriever.serviceContext, responseSynthesizerObj.textQAPromptTemplate),
|
||||||
|
serviceContext: vectorStoreRetriever.serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
||||||
|
} else if (responseSynthesizerObj.type === 'CompactAndRefine') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new CompactAndRefine(
|
||||||
|
vectorStoreRetriever.serviceContext,
|
||||||
|
responseSynthesizerObj.textQAPromptTemplate,
|
||||||
|
responseSynthesizerObj.refinePromptTemplate
|
||||||
|
),
|
||||||
|
serviceContext: vectorStoreRetriever.serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
||||||
|
} else if (responseSynthesizerObj.type === 'Refine') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new Refine(
|
||||||
|
vectorStoreRetriever.serviceContext,
|
||||||
|
responseSynthesizerObj.textQAPromptTemplate,
|
||||||
|
responseSynthesizerObj.refinePromptTemplate
|
||||||
|
),
|
||||||
|
serviceContext: vectorStoreRetriever.serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
||||||
|
} else if (responseSynthesizerObj.type === 'SimpleResponseBuilder') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new SimpleResponseBuilder(vectorStoreRetriever.serviceContext),
|
||||||
|
serviceContext: vectorStoreRetriever.serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = new RetrieverQueryEngine(vectorStoreRetriever, responseSynthesizer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryEngine
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { nodeClass: QueryEngine_LlamaIndex }
|
module.exports = { nodeClass: QueryEngine_LlamaIndex }
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ class SubQuestionQueryEngine_LlamaIndex implements INode {
|
|||||||
constructor(fields?: { sessionId?: string }) {
|
constructor(fields?: { sessionId?: string }) {
|
||||||
this.label = 'Sub Question Query Engine'
|
this.label = 'Sub Question Query Engine'
|
||||||
this.name = 'subQuestionQueryEngine'
|
this.name = 'subQuestionQueryEngine'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.type = 'SubQuestionQueryEngine'
|
this.type = 'SubQuestionQueryEngine'
|
||||||
this.icon = 'subQueryEngine.svg'
|
this.icon = 'subQueryEngine.svg'
|
||||||
this.category = 'Engine'
|
this.category = 'Engine'
|
||||||
this.description =
|
this.description =
|
||||||
'Breaks complex query into sub questions for each relevant data source, then gather all the intermediate reponses and synthesizes a final response'
|
'Breaks complex query into sub questions for each relevant data source, then gather all the intermediate reponses and synthesizes a final response'
|
||||||
this.baseClasses = [this.type]
|
this.baseClasses = [this.type, 'BaseQueryEngine']
|
||||||
this.tags = ['LlamaIndex']
|
this.tags = ['LlamaIndex']
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
{
|
{
|
||||||
@@ -76,85 +76,13 @@ class SubQuestionQueryEngine_LlamaIndex implements INode {
|
|||||||
this.sessionId = fields?.sessionId
|
this.sessionId = fields?.sessionId
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
return null
|
return prepareEngine(nodeData)
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string | object> {
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string | object> {
|
||||||
const returnSourceDocuments = nodeData.inputs?.returnSourceDocuments as boolean
|
const returnSourceDocuments = nodeData.inputs?.returnSourceDocuments as boolean
|
||||||
const embeddings = nodeData.inputs?.embeddings as BaseEmbedding
|
const queryEngine = prepareEngine(nodeData)
|
||||||
const model = nodeData.inputs?.model
|
|
||||||
|
|
||||||
const serviceContext = serviceContextFromDefaults({
|
|
||||||
llm: model,
|
|
||||||
embedModel: embeddings
|
|
||||||
})
|
|
||||||
|
|
||||||
let queryEngineTools = nodeData.inputs?.queryEngineTools as QueryEngineTool[]
|
|
||||||
queryEngineTools = flatten(queryEngineTools)
|
|
||||||
|
|
||||||
let queryEngine = SubQuestionQueryEngine.fromDefaults({
|
|
||||||
serviceContext,
|
|
||||||
queryEngineTools,
|
|
||||||
questionGen: new LLMQuestionGenerator({ llm: model })
|
|
||||||
})
|
|
||||||
|
|
||||||
const responseSynthesizerObj = nodeData.inputs?.responseSynthesizer
|
|
||||||
if (responseSynthesizerObj) {
|
|
||||||
if (responseSynthesizerObj.type === 'TreeSummarize') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new TreeSummarize(serviceContext, responseSynthesizerObj.textQAPromptTemplate),
|
|
||||||
serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
|
||||||
responseSynthesizer,
|
|
||||||
serviceContext,
|
|
||||||
queryEngineTools,
|
|
||||||
questionGen: new LLMQuestionGenerator({ llm: model })
|
|
||||||
})
|
|
||||||
} else if (responseSynthesizerObj.type === 'CompactAndRefine') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new CompactAndRefine(
|
|
||||||
serviceContext,
|
|
||||||
responseSynthesizerObj.textQAPromptTemplate,
|
|
||||||
responseSynthesizerObj.refinePromptTemplate
|
|
||||||
),
|
|
||||||
serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
|
||||||
responseSynthesizer,
|
|
||||||
serviceContext,
|
|
||||||
queryEngineTools,
|
|
||||||
questionGen: new LLMQuestionGenerator({ llm: model })
|
|
||||||
})
|
|
||||||
} else if (responseSynthesizerObj.type === 'Refine') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new Refine(
|
|
||||||
serviceContext,
|
|
||||||
responseSynthesizerObj.textQAPromptTemplate,
|
|
||||||
responseSynthesizerObj.refinePromptTemplate
|
|
||||||
),
|
|
||||||
serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
|
||||||
responseSynthesizer,
|
|
||||||
serviceContext,
|
|
||||||
queryEngineTools,
|
|
||||||
questionGen: new LLMQuestionGenerator({ llm: model })
|
|
||||||
})
|
|
||||||
} else if (responseSynthesizerObj.type === 'SimpleResponseBuilder') {
|
|
||||||
const responseSynthesizer = new ResponseSynthesizer({
|
|
||||||
responseBuilder: new SimpleResponseBuilder(serviceContext),
|
|
||||||
serviceContext
|
|
||||||
})
|
|
||||||
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
|
||||||
responseSynthesizer,
|
|
||||||
serviceContext,
|
|
||||||
queryEngineTools,
|
|
||||||
questionGen: new LLMQuestionGenerator({ llm: model })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = ''
|
let text = ''
|
||||||
let sourceDocuments: ICommonObject[] = []
|
let sourceDocuments: ICommonObject[] = []
|
||||||
@@ -190,4 +118,82 @@ class SubQuestionQueryEngine_LlamaIndex implements INode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const prepareEngine = (nodeData: INodeData) => {
|
||||||
|
const embeddings = nodeData.inputs?.embeddings as BaseEmbedding
|
||||||
|
const model = nodeData.inputs?.model
|
||||||
|
|
||||||
|
const serviceContext = serviceContextFromDefaults({
|
||||||
|
llm: model,
|
||||||
|
embedModel: embeddings
|
||||||
|
})
|
||||||
|
|
||||||
|
let queryEngineTools = nodeData.inputs?.queryEngineTools as QueryEngineTool[]
|
||||||
|
queryEngineTools = flatten(queryEngineTools)
|
||||||
|
|
||||||
|
let queryEngine = SubQuestionQueryEngine.fromDefaults({
|
||||||
|
serviceContext,
|
||||||
|
queryEngineTools,
|
||||||
|
questionGen: new LLMQuestionGenerator({ llm: model })
|
||||||
|
})
|
||||||
|
|
||||||
|
const responseSynthesizerObj = nodeData.inputs?.responseSynthesizer
|
||||||
|
if (responseSynthesizerObj) {
|
||||||
|
if (responseSynthesizerObj.type === 'TreeSummarize') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new TreeSummarize(serviceContext, responseSynthesizerObj.textQAPromptTemplate),
|
||||||
|
serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
||||||
|
responseSynthesizer,
|
||||||
|
serviceContext,
|
||||||
|
queryEngineTools,
|
||||||
|
questionGen: new LLMQuestionGenerator({ llm: model })
|
||||||
|
})
|
||||||
|
} else if (responseSynthesizerObj.type === 'CompactAndRefine') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new CompactAndRefine(
|
||||||
|
serviceContext,
|
||||||
|
responseSynthesizerObj.textQAPromptTemplate,
|
||||||
|
responseSynthesizerObj.refinePromptTemplate
|
||||||
|
),
|
||||||
|
serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
||||||
|
responseSynthesizer,
|
||||||
|
serviceContext,
|
||||||
|
queryEngineTools,
|
||||||
|
questionGen: new LLMQuestionGenerator({ llm: model })
|
||||||
|
})
|
||||||
|
} else if (responseSynthesizerObj.type === 'Refine') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new Refine(
|
||||||
|
serviceContext,
|
||||||
|
responseSynthesizerObj.textQAPromptTemplate,
|
||||||
|
responseSynthesizerObj.refinePromptTemplate
|
||||||
|
),
|
||||||
|
serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
||||||
|
responseSynthesizer,
|
||||||
|
serviceContext,
|
||||||
|
queryEngineTools,
|
||||||
|
questionGen: new LLMQuestionGenerator({ llm: model })
|
||||||
|
})
|
||||||
|
} else if (responseSynthesizerObj.type === 'SimpleResponseBuilder') {
|
||||||
|
const responseSynthesizer = new ResponseSynthesizer({
|
||||||
|
responseBuilder: new SimpleResponseBuilder(serviceContext),
|
||||||
|
serviceContext
|
||||||
|
})
|
||||||
|
queryEngine = SubQuestionQueryEngine.fromDefaults({
|
||||||
|
responseSynthesizer,
|
||||||
|
serviceContext,
|
||||||
|
queryEngineTools,
|
||||||
|
questionGen: new LLMQuestionGenerator({ llm: model })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryEngine
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { nodeClass: SubQuestionQueryEngine_LlamaIndex }
|
module.exports = { nodeClass: SubQuestionQueryEngine_LlamaIndex }
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { Bedrock } from '@langchain/community/llms/bedrock'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
|
import { BaseBedrockInput } from 'langchain/dist/util/bedrock'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { Bedrock } from 'langchain/llms/bedrock'
|
|
||||||
import { BaseBedrockInput } from 'langchain/dist/util/bedrock'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I had to run the following to build the component
|
* I had to run the following to build the component
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { AzureOpenAIInput, OpenAI, OpenAIInput } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { AzureOpenAIInput, OpenAI, OpenAIInput } from 'langchain/llms/openai'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
class AzureOpenAI_LLMs implements INode {
|
class AzureOpenAI_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
|
import { NIBittensorLLM, BittensorInput } from 'langchain/experimental/llms/bittensor'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { NIBittensorLLM, BittensorInput } from 'langchain/experimental/llms/bittensor'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class Bittensor_LLMs implements INode {
|
class Bittensor_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { Cohere, CohereInput } from './core'
|
import { Cohere, CohereInput } from './core'
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class Cohere_LLMs implements INode {
|
class Cohere_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { LLM, BaseLLMParams } from 'langchain/llms/base'
|
import { LLM, BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
|
|
||||||
export interface CohereInput extends BaseLLMParams {
|
export interface CohereInput extends BaseLLMParams {
|
||||||
/** Sampling temperature to use */
|
/** Sampling temperature to use */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import { GooglePaLM, GooglePaLMTextInput } from '@langchain/community/llms/googlepalm'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { GooglePaLM, GooglePaLMTextInput } from 'langchain/llms/googlepalm'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
class GooglePaLM_LLMs implements INode {
|
class GooglePaLM_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { GoogleAuthOptions } from 'google-auth-library'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { GoogleVertexAI, GoogleVertexAITextInput } from '@langchain/community/llms/googlevertexai'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { GoogleVertexAI, GoogleVertexAITextInput } from 'langchain/llms/googlevertexai'
|
|
||||||
import { GoogleAuthOptions } from 'google-auth-library'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class GoogleVertexAI_LLMs implements INode {
|
class GoogleVertexAI_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { HFInput, HuggingFaceInference } from './core'
|
import { HFInput, HuggingFaceInference } from './core'
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class HuggingFaceInference_LLMs implements INode {
|
class HuggingFaceInference_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { LLM, BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { getEnvironmentVariable } from '../../../src/utils'
|
import { getEnvironmentVariable } from '../../../src/utils'
|
||||||
import { LLM, BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
export interface HFInput {
|
export interface HFInput {
|
||||||
/** Model to use */
|
/** Model to use */
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { Ollama, OllamaInput } from '@langchain/community/llms/ollama'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
import { Ollama, OllamaInput } from 'langchain/llms/ollama'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class Ollama_LLMs implements INode {
|
class Ollama_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { OpenAI, OpenAIInput } from '@langchain/openai'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { OpenAI, OpenAIInput } from 'langchain/llms/openai'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
|
|
||||||
class OpenAI_LLMs implements INode {
|
class OpenAI_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { Replicate, ReplicateInput } from '@langchain/community/llms/replicate'
|
||||||
|
import { BaseCache } from '@langchain/core/caches'
|
||||||
|
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { Replicate, ReplicateInput } from 'langchain/llms/replicate'
|
|
||||||
import { BaseCache } from 'langchain/schema'
|
|
||||||
import { BaseLLMParams } from 'langchain/llms/base'
|
|
||||||
|
|
||||||
class Replicate_LLMs implements INode {
|
class Replicate_LLMs implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { FlowiseMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
import { FlowiseMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
||||||
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
||||||
import { BaseMessage } from 'langchain/schema'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
|
|
||||||
class BufferMemory_Memory implements INode {
|
class BufferMemory_Memory implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { FlowiseWindowMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
import { FlowiseWindowMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods } from '../../../src/Interface'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
||||||
import { BufferWindowMemory, BufferWindowMemoryInput } from 'langchain/memory'
|
import { BufferWindowMemory, BufferWindowMemoryInput } from 'langchain/memory'
|
||||||
import { BaseMessage } from 'langchain/schema'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
|
|
||||||
class BufferWindowMemory_Memory implements INode {
|
class BufferWindowMemory_Memory implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { FlowiseSummaryMemory, IMessage, INode, INodeData, INodeParams, MemoryMe
|
|||||||
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses } from '../../../src/utils'
|
||||||
import { ConversationSummaryMemory, ConversationSummaryMemoryInput } from 'langchain/memory'
|
import { ConversationSummaryMemory, ConversationSummaryMemoryInput } from 'langchain/memory'
|
||||||
import { BaseLanguageModel } from 'langchain/base_language'
|
import { BaseLanguageModel } from 'langchain/base_language'
|
||||||
import { BaseMessage } from 'langchain/schema'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
|
|
||||||
class ConversationSummaryMemory_Memory implements INode {
|
class ConversationSummaryMemory_Memory implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import {
|
|||||||
DeleteItemCommandInput,
|
DeleteItemCommandInput,
|
||||||
AttributeValue
|
AttributeValue
|
||||||
} from '@aws-sdk/client-dynamodb'
|
} from '@aws-sdk/client-dynamodb'
|
||||||
import { DynamoDBChatMessageHistory } from 'langchain/stores/message/dynamodb'
|
import { DynamoDBChatMessageHistory } from '@langchain/community/stores/message/dynamodb'
|
||||||
|
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, StoredMessage, BaseMessage } from '@langchain/core/messages'
|
||||||
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
||||||
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, StoredMessage, BaseMessage } from 'langchain/schema'
|
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MongoClient, Collection, Document } from 'mongodb'
|
import { MongoClient, Collection, Document } from 'mongodb'
|
||||||
import { MongoDBChatMessageHistory } from 'langchain/stores/message/mongodb'
|
import { MongoDBChatMessageHistory } from '@langchain/community/stores/message/mongodb'
|
||||||
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
||||||
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, BaseMessage } from 'langchain/schema'
|
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, BaseMessage } from '@langchain/core/messages'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCre
|
|||||||
import { ICommonObject } from '../../../src'
|
import { ICommonObject } from '../../../src'
|
||||||
import { MotorheadMemory, MotorheadMemoryInput, InputValues, OutputValues } from 'langchain/memory'
|
import { MotorheadMemory, MotorheadMemoryInput, InputValues, OutputValues } from 'langchain/memory'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import { AIMessage, BaseMessage, ChatMessage, HumanMessage } from 'langchain/schema'
|
import { AIMessage, BaseMessage, ChatMessage, HumanMessage } from '@langchain/core/messages'
|
||||||
|
|
||||||
type MotorheadMessage = {
|
type MotorheadMessage = {
|
||||||
content: string
|
content: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Redis, RedisOptions } from 'ioredis'
|
import { Redis, RedisOptions } from 'ioredis'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
||||||
import { RedisChatMessageHistory, RedisChatMessageHistoryInput } from 'langchain/stores/message/ioredis'
|
import { RedisChatMessageHistory, RedisChatMessageHistoryInput } from '@langchain/community/stores/message/ioredis'
|
||||||
import { mapStoredMessageToChatMessage, BaseMessage, AIMessage, HumanMessage } from 'langchain/schema'
|
import { mapStoredMessageToChatMessage, BaseMessage, AIMessage, HumanMessage } from '@langchain/core/messages'
|
||||||
import { INode, INodeData, INodeParams, ICommonObject, MessageType, IMessage, MemoryMethods, FlowiseMemory } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams, ICommonObject, MessageType, IMessage, MemoryMethods, FlowiseMemory } from '../../../src/Interface'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { Redis } from '@upstash/redis'
|
import { Redis } from '@upstash/redis'
|
||||||
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
|
||||||
import { UpstashRedisChatMessageHistory } from 'langchain/stores/message/upstash_redis'
|
import { UpstashRedisChatMessageHistory } from '@langchain/community/stores/message/upstash_redis'
|
||||||
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, StoredMessage, BaseMessage } from 'langchain/schema'
|
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, StoredMessage, BaseMessage } from '@langchain/core/messages'
|
||||||
import { FlowiseMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
import { FlowiseMemory, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { ICommonObject } from '../../../src/Interface'
|
import { ICommonObject } from '../../../src/Interface'
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
import { ZepMemory, ZepMemoryInput } from '@langchain/community/memory/zep'
|
||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { BaseMessage } from '@langchain/core/messages'
|
||||||
import { ZepMemory, ZepMemoryInput } from 'langchain/memory/zep'
|
|
||||||
import { ICommonObject } from '../../../src'
|
|
||||||
import { InputValues, MemoryVariables, OutputValues } from 'langchain/memory'
|
import { InputValues, MemoryVariables, OutputValues } from 'langchain/memory'
|
||||||
import { BaseMessage } from 'langchain/schema'
|
import { IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType, ICommonObject } from '../../../src/Interface'
|
||||||
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
|
|
||||||
class ZepMemory_Memory implements INode {
|
class ZepMemory_Memory implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src'
|
|
||||||
import { Moderation } from '../Moderation'
|
import { Moderation } from '../Moderation'
|
||||||
import { OpenAIModerationRunner } from './OpenAIModerationRunner'
|
import { OpenAIModerationRunner } from './OpenAIModerationRunner'
|
||||||
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src'
|
||||||
|
|
||||||
class OpenAIModeration implements INode {
|
class OpenAIModeration implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
|||||||
import { getBaseClasses } from '../../../src'
|
import { getBaseClasses } from '../../../src'
|
||||||
import { Moderation } from '../Moderation'
|
import { Moderation } from '../Moderation'
|
||||||
import { SimplePromptModerationRunner } from './SimplePromptModerationRunner'
|
import { SimplePromptModerationRunner } from './SimplePromptModerationRunner'
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
|
||||||
class SimplePromptModeration implements INode {
|
class SimplePromptModeration implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Moderation } from '../Moderation'
|
import { Moderation } from '../Moderation'
|
||||||
import { BaseChatModel } from 'langchain/chat_models/base'
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||||
|
|
||||||
export class SimplePromptModerationRunner implements Moderation {
|
export class SimplePromptModerationRunner implements Moderation {
|
||||||
private readonly denyList: string = ''
|
private readonly denyList: string = ''
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user