mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Merge branch 'main' into feature/Credential
# Conflicts: # README.md # docker/.env.example # packages/components/nodes/documentloaders/Notion/NotionDB.ts # packages/components/nodes/memory/DynamoDb/DynamoDb.ts # packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts # packages/components/nodes/memory/ZepMemory/ZepMemory.ts # packages/components/package.json # packages/components/src/utils.ts # packages/server/.env.example # packages/server/README.md # packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json # packages/server/src/ChildProcess.ts # packages/server/src/DataSource.ts # packages/server/src/commands/start.ts # packages/server/src/index.ts # packages/server/src/utils/index.ts # packages/server/src/utils/logger.ts
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
PORT=3000
|
||||
PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key
|
||||
# DATABASE_PATH=/your_database_path/.flowise
|
||||
# APIKEY_PATH=/your_api_key_path/.flowise
|
||||
# SECRETKEY_PATH=/your_api_key_path/.flowise
|
||||
# LOG_PATH=/your_log_path/.flowise/logs
|
||||
|
||||
# DATABASE_TYPE=postgres
|
||||
# DATABASE_PORT=""
|
||||
# DATABASE_HOST=""
|
||||
# DATABASE_NAME="flowise"
|
||||
# DATABASE_USER=""
|
||||
# DATABASE_PASSWORD=""
|
||||
# OVERRIDE_DATABASE=true
|
||||
|
||||
# FLOWISE_USERNAME=user
|
||||
# FLOWISE_PASSWORD=1234
|
||||
# DEBUG=true
|
||||
# DATABASE_PATH=/your/database/path/.flowise
|
||||
# APIKEY_PATH=/your/api/key/path
|
||||
# SECRETKEY_PATH=/your/secret/key/path
|
||||
# LOG_PATH=/your/log/path
|
||||
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
||||
# EXECUTION_MODE=main (child | main)
|
||||
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
|
||||
# TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash
|
||||
|
||||
@@ -31,21 +31,7 @@ FLOWISE_PASSWORD=1234
|
||||
|
||||
## 🌱 Env Variables
|
||||
|
||||
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder.
|
||||
|
||||
| Variable | Description | Type | Default |
|
||||
| ---------------- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
||||
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
||||
| PASSPHRASE | Passphrase used to create encryption key | String | `MYPASSPHRASE` |
|
||||
| FLOWISE_USERNAME | Username to login | String |
|
||||
| FLOWISE_PASSWORD | Password to login | String |
|
||||
| DEBUG | Print logs from components | Boolean |
|
||||
| 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` |
|
||||
| DATABASE_PATH | Location where database is saved | String | `your/home/dir/.flowise` |
|
||||
| APIKEY_PATH | Location where api keys are saved | String | `your/path/Flowise/packages/server` |
|
||||
| SECRETKEY_PATH | Location where encryption key (used to encrypt/decrypt credentials) is saved | String | `your/path/Flowise/packages/server` |
|
||||
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
||||
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://github.com/FlowiseAI/Flowise/blob/main/CONTRIBUTING.md#-env-variables)
|
||||
|
||||
You can also specify the env variables when using `npx`. For example:
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"description": "Use OpenAI Function Agent to automatically decide which API to call, generating url and body request from conversation",
|
||||
"description": "Use OpenAI Function Agent and Chain to automatically decide which API to call, generating url and body request from conversation",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
@@ -0,0 +1,226 @@
|
||||
{
|
||||
"description": "Analyse and summarize CSV data",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 377,
|
||||
"id": "csvAgent_0",
|
||||
"position": {
|
||||
"x": 1064.0780498701288,
|
||||
"y": 284.44352695304724
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "csvAgent_0",
|
||||
"label": "CSV Agent",
|
||||
"name": "csvAgent",
|
||||
"type": "AgentExecutor",
|
||||
"baseClasses": ["AgentExecutor", "BaseChain"],
|
||||
"category": "Agents",
|
||||
"description": "Agent used to to answer queries on CSV data",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Csv File",
|
||||
"name": "csvFile",
|
||||
"type": "file",
|
||||
"fileType": ".csv",
|
||||
"id": "csvAgent_0-input-csvFile-file"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "csvAgent_0-input-model-BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "csvAgent_0-output-csvAgent-AgentExecutor|BaseChain",
|
||||
"name": "csvAgent",
|
||||
"label": "AgentExecutor",
|
||||
"type": "AgentExecutor | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1064.0780498701288,
|
||||
"y": 284.44352695304724
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 522,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 657.3762197414501,
|
||||
"y": 220.2950766042332
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"category": "Chat Models",
|
||||
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "chatOpenAI_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "gpt-4",
|
||||
"name": "gpt-4"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-0613",
|
||||
"name": "gpt-4-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k",
|
||||
"name": "gpt-4-32k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k-0613",
|
||||
"name": "gpt-4-32k-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo",
|
||||
"name": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-0613",
|
||||
"name": "gpt-3.5-turbo-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k",
|
||||
"name": "gpt-3.5-turbo-16k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k-0613",
|
||||
"name": "gpt-3.5-turbo-16k-0613"
|
||||
}
|
||||
],
|
||||
"default": "gpt-3.5-turbo",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-basepath-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 657.3762197414501,
|
||||
"y": 220.2950766042332
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "csvAgent_0",
|
||||
"targetHandle": "csvAgent_0-input-model-BaseLanguageModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-csvAgent_0-csvAgent_0-input-model-BaseLanguageModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -3,132 +3,11 @@
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 376,
|
||||
"id": "recursiveCharacterTextSplitter_1",
|
||||
"position": {
|
||||
"x": 422.81091375202413,
|
||||
"y": 122.99825010325736
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "recursiveCharacterTextSplitter_1",
|
||||
"label": "Recursive Character Text Splitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter",
|
||||
"baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"],
|
||||
"category": "Text Splitters",
|
||||
"description": "Split documents recursively by different characters - starting with \"\n\n\", then \"\n\", then \" \"",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chunk Size",
|
||||
"name": "chunkSize",
|
||||
"type": "number",
|
||||
"default": 1000,
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_1-input-chunkSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Chunk Overlap",
|
||||
"name": "chunkOverlap",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_1-input-chunkOverlap-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"chunkSize": 1000,
|
||||
"chunkOverlap": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"label": "RecursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter | TextSplitter"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 422.81091375202413,
|
||||
"y": 122.99825010325736
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 392,
|
||||
"id": "textFile_1",
|
||||
"position": {
|
||||
"x": 788.5395420616719,
|
||||
"y": 126.30459801017741
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "textFile_1",
|
||||
"label": "Text File",
|
||||
"name": "textFile",
|
||||
"type": "Document",
|
||||
"baseClasses": ["Document"],
|
||||
"category": "Document Loaders",
|
||||
"description": "Load data from text files",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Txt File",
|
||||
"name": "txtFile",
|
||||
"type": "file",
|
||||
"fileType": ".txt",
|
||||
"id": "textFile_1-input-txtFile-file"
|
||||
},
|
||||
{
|
||||
"label": "Metadata",
|
||||
"name": "metadata",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "textFile_1-input-metadata-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Text Splitter",
|
||||
"name": "textSplitter",
|
||||
"type": "TextSplitter",
|
||||
"optional": true,
|
||||
"id": "textFile_1-input-textSplitter-TextSplitter"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"textSplitter": "{{recursiveCharacterTextSplitter_1.data.instance}}"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "textFile_1-output-textFile-Document",
|
||||
"name": "textFile",
|
||||
"label": "Document",
|
||||
"type": "Document"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 788.5395420616719,
|
||||
"y": 126.30459801017741
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 523,
|
||||
"height": 522,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 1200.8283780918746,
|
||||
"y": 12.591428916196605
|
||||
"x": 1184.1176114500388,
|
||||
"y": -44.15535835370571
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -249,7 +128,7 @@
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"temperature": "0",
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
@@ -268,129 +147,20 @@
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1200.8283780918746,
|
||||
"y": 12.591428916196605
|
||||
"x": 1184.1176114500388,
|
||||
"y": -44.15535835370571
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 480,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 1626.7402076624098,
|
||||
"y": 394.29095783927113
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}",
|
||||
"memory": "",
|
||||
"returnSourceDocuments": "",
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1626.7402076624098,
|
||||
"y": 394.29095783927113
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 329,
|
||||
"height": 328,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 788.1802387155774,
|
||||
"y": 579.9826205586049
|
||||
"x": 795.6162477805387,
|
||||
"y": 603.260214150876
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -462,18 +232,18 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 788.1802387155774,
|
||||
"y": 579.9826205586049
|
||||
"x": 795.6162477805387,
|
||||
"y": 603.260214150876
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 555,
|
||||
"height": 554,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1200.8283780918746,
|
||||
"y": 588.825080688097
|
||||
"x": 1191.1792786926865,
|
||||
"y": 514.2126330994578
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -534,7 +304,7 @@
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": ["{{textFile_1.data.instance}}"],
|
||||
"document": ["{{textFile_0.data.instance}}"],
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"pineconeIndex": "",
|
||||
"pineconeNamespace": "",
|
||||
@@ -569,20 +339,272 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1200.8283780918746,
|
||||
"y": 588.825080688097
|
||||
"x": 1191.1792786926865,
|
||||
"y": 514.2126330994578
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 376,
|
||||
"id": "recursiveCharacterTextSplitter_0",
|
||||
"position": {
|
||||
"x": 406.08456707531263,
|
||||
"y": 197.66460328693972
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "recursiveCharacterTextSplitter_0",
|
||||
"label": "Recursive Character Text Splitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter",
|
||||
"baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"],
|
||||
"category": "Text Splitters",
|
||||
"description": "Split documents recursively by different characters - starting with \"\\n\\n\", then \"\\n\", then \" \"",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chunk Size",
|
||||
"name": "chunkSize",
|
||||
"type": "number",
|
||||
"default": 1000,
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_0-input-chunkSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Chunk Overlap",
|
||||
"name": "chunkOverlap",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_0-input-chunkOverlap-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"chunkSize": 1000,
|
||||
"chunkOverlap": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"label": "RecursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter | TextSplitter"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 406.08456707531263,
|
||||
"y": 197.66460328693972
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 410,
|
||||
"id": "textFile_0",
|
||||
"position": {
|
||||
"x": 786.5497697231324,
|
||||
"y": 140.09563157584407
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "textFile_0",
|
||||
"label": "Text File",
|
||||
"name": "textFile",
|
||||
"type": "Document",
|
||||
"baseClasses": ["Document"],
|
||||
"category": "Document Loaders",
|
||||
"description": "Load data from text files",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Txt File",
|
||||
"name": "txtFile",
|
||||
"type": "file",
|
||||
"fileType": ".txt",
|
||||
"id": "textFile_0-input-txtFile-file"
|
||||
},
|
||||
{
|
||||
"label": "Metadata",
|
||||
"name": "metadata",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "textFile_0-input-metadata-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Text Splitter",
|
||||
"name": "textSplitter",
|
||||
"type": "TextSplitter",
|
||||
"optional": true,
|
||||
"id": "textFile_0-input-textSplitter-TextSplitter"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"textSplitter": "{{recursiveCharacterTextSplitter_0.data.instance}}",
|
||||
"metadata": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "textFile_0-output-textFile-Document",
|
||||
"name": "textFile",
|
||||
"label": "Document",
|
||||
"type": "Document"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 786.5497697231324,
|
||||
"y": 140.09563157584407
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 479,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 1558.6564094656787,
|
||||
"y": 386.60217819991124
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}",
|
||||
"memory": "",
|
||||
"returnSourceDocuments": "",
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 1558.6564094656787,
|
||||
"y": 386.60217819991124
|
||||
},
|
||||
"selected": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "recursiveCharacterTextSplitter_1",
|
||||
"sourceHandle": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"target": "textFile_1",
|
||||
"targetHandle": "textFile_1-input-textSplitter-TextSplitter",
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "recursiveCharacterTextSplitter_1-recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-textFile_1-textFile_1-input-textSplitter-TextSplitter",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "recursiveCharacterTextSplitter_0",
|
||||
"sourceHandle": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"target": "textFile_0",
|
||||
"targetHandle": "textFile_0-input-textSplitter-TextSplitter",
|
||||
"type": "buttonedge",
|
||||
"id": "recursiveCharacterTextSplitter_0-recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-textFile_0-textFile_0-input-textSplitter-TextSplitter",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "textFile_0",
|
||||
"sourceHandle": "textFile_0-output-textFile-Document",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-document-Document",
|
||||
"type": "buttonedge",
|
||||
"id": "textFile_0-textFile_0-output-textFile-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
@@ -598,28 +620,6 @@
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "textFile_1",
|
||||
"sourceHandle": "textFile_1-output-textFile-Document",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-document-Document",
|
||||
"type": "buttonedge",
|
||||
"id": "textFile_1-textFile_1-output-textFile-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
|
||||
@@ -0,0 +1,637 @@
|
||||
{
|
||||
"description": "Flowise Docs Github QnA using conversational retrieval QA chain",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 376,
|
||||
"id": "markdownTextSplitter_0",
|
||||
"position": {
|
||||
"x": 1081.1540334344143,
|
||||
"y": -113.73571627207801
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "markdownTextSplitter_0",
|
||||
"label": "Markdown Text Splitter",
|
||||
"name": "markdownTextSplitter",
|
||||
"type": "MarkdownTextSplitter",
|
||||
"baseClasses": ["MarkdownTextSplitter", "RecursiveCharacterTextSplitter", "TextSplitter", "BaseDocumentTransformer"],
|
||||
"category": "Text Splitters",
|
||||
"description": "Split your content into documents based on the Markdown headers",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chunk Size",
|
||||
"name": "chunkSize",
|
||||
"type": "number",
|
||||
"default": 1000,
|
||||
"optional": true,
|
||||
"id": "markdownTextSplitter_0-input-chunkSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Chunk Overlap",
|
||||
"name": "chunkOverlap",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "markdownTextSplitter_0-input-chunkOverlap-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"chunkSize": "4000",
|
||||
"chunkOverlap": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer",
|
||||
"name": "markdownTextSplitter",
|
||||
"label": "MarkdownTextSplitter",
|
||||
"type": "MarkdownTextSplitter | RecursiveCharacterTextSplitter | TextSplitter | BaseDocumentTransformer"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1081.1540334344143,
|
||||
"y": -113.73571627207801
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 405,
|
||||
"id": "memoryVectorStore_0",
|
||||
"position": {
|
||||
"x": 1844.88052464165,
|
||||
"y": 484.60473328470243
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "memoryVectorStore_0",
|
||||
"label": "In-Memory Vector Store",
|
||||
"name": "memoryVectorStore",
|
||||
"type": "Memory",
|
||||
"baseClasses": ["Memory", "VectorStoreRetriever", "BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "In-memory vectorstore that stores embeddings and does an exact, linear search for the most similar embeddings.",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Top K",
|
||||
"name": "topK",
|
||||
"description": "Number of top results to fetch. Default to 4",
|
||||
"placeholder": "4",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "memoryVectorStore_0-input-topK-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"list": true,
|
||||
"id": "memoryVectorStore_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "memoryVectorStore_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": ["{{github_0.data.instance}}"],
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"topK": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Memory Retriever",
|
||||
"type": "Memory | VectorStoreRetriever | BaseRetriever"
|
||||
},
|
||||
{
|
||||
"id": "memoryVectorStore_0-output-vectorStore-Memory|VectorStore",
|
||||
"name": "vectorStore",
|
||||
"label": "Memory Vector Store",
|
||||
"type": "Memory | VectorStore"
|
||||
}
|
||||
],
|
||||
"default": "retriever"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"output": "retriever"
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1844.88052464165,
|
||||
"y": 484.60473328470243
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 479,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 2311.697827287373,
|
||||
"y": 228.14841720207832
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{memoryVectorStore_0.data.instance}}",
|
||||
"memory": "",
|
||||
"returnSourceDocuments": true,
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false,
|
||||
"positionAbsolute": {
|
||||
"x": 2311.697827287373,
|
||||
"y": 228.14841720207832
|
||||
}
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 673,
|
||||
"id": "github_0",
|
||||
"position": {
|
||||
"x": 1460.1858988997,
|
||||
"y": -137.83585695472374
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "github_0",
|
||||
"label": "Github",
|
||||
"name": "github",
|
||||
"type": "Document",
|
||||
"baseClasses": ["Document"],
|
||||
"category": "Document Loaders",
|
||||
"description": "Load data from a GitHub repository",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"description": "Only needed when accessing private repo",
|
||||
"optional": true,
|
||||
"credentialNames": ["githubApi"],
|
||||
"id": "github_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Repo Link",
|
||||
"name": "repoLink",
|
||||
"type": "string",
|
||||
"placeholder": "https://github.com/FlowiseAI/Flowise",
|
||||
"id": "github_0-input-repoLink-string"
|
||||
},
|
||||
{
|
||||
"label": "Branch",
|
||||
"name": "branch",
|
||||
"type": "string",
|
||||
"default": "main",
|
||||
"id": "github_0-input-branch-string"
|
||||
},
|
||||
{
|
||||
"label": "Recursive",
|
||||
"name": "recursive",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "github_0-input-recursive-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Metadata",
|
||||
"name": "metadata",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "github_0-input-metadata-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Text Splitter",
|
||||
"name": "textSplitter",
|
||||
"type": "TextSplitter",
|
||||
"optional": true,
|
||||
"id": "github_0-input-textSplitter-TextSplitter"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"repoLink": "https://github.com/FlowiseAI/FlowiseDocs",
|
||||
"branch": "main",
|
||||
"recursive": true,
|
||||
"textSplitter": "{{markdownTextSplitter_0.data.instance}}",
|
||||
"metadata": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "github_0-output-github-Document",
|
||||
"name": "github",
|
||||
"label": "Document",
|
||||
"type": "Document"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1460.1858988997,
|
||||
"y": -137.83585695472374
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 522,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 1857.367353502965,
|
||||
"y": -104.25095383414119
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"category": "Chat Models",
|
||||
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "chatOpenAI_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "gpt-4",
|
||||
"name": "gpt-4"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-0613",
|
||||
"name": "gpt-4-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k",
|
||||
"name": "gpt-4-32k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k-0613",
|
||||
"name": "gpt-4-32k-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo",
|
||||
"name": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-0613",
|
||||
"name": "gpt-3.5-turbo-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k",
|
||||
"name": "gpt-3.5-turbo-16k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k-0613",
|
||||
"name": "gpt-3.5-turbo-16k-0613"
|
||||
}
|
||||
],
|
||||
"default": "gpt-3.5-turbo",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-basepath-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1857.367353502965,
|
||||
"y": -104.25095383414119
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 328,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 1299.9983863833309,
|
||||
"y": 581.8406384863323
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openAIEmbeddings_0",
|
||||
"label": "OpenAI Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings",
|
||||
"baseClasses": ["OpenAIEmbeddings", "Embeddings"],
|
||||
"category": "Embeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "openAIEmbeddings_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Strip New Lines",
|
||||
"name": "stripNewLines",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Batch Size",
|
||||
"name": "batchSize",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-batchSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-basepath-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"stripNewLines": "",
|
||||
"batchSize": "",
|
||||
"timeout": "",
|
||||
"basepath": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1299.9983863833309,
|
||||
"y": 581.8406384863323
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "memoryVectorStore_0",
|
||||
"sourceHandle": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "memoryVectorStore_0-memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "markdownTextSplitter_0",
|
||||
"sourceHandle": "markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer",
|
||||
"target": "github_0",
|
||||
"targetHandle": "github_0-input-textSplitter-TextSplitter",
|
||||
"type": "buttonedge",
|
||||
"id": "markdownTextSplitter_0-markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer-github_0-github_0-input-textSplitter-TextSplitter",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "github_0",
|
||||
"sourceHandle": "github_0-output-github-Document",
|
||||
"target": "memoryVectorStore_0",
|
||||
"targetHandle": "memoryVectorStore_0-input-document-Document",
|
||||
"type": "buttonedge",
|
||||
"id": "github_0-github_0-output-github-Document-memoryVectorStore_0-memoryVectorStore_0-input-document-Document",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "memoryVectorStore_0",
|
||||
"targetHandle": "memoryVectorStore_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-memoryVectorStore_0-memoryVectorStore_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -135,15 +135,16 @@
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatLocalAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{faissUpsert_0.data.instance}}"
|
||||
"vectorStoreRetriever": "{{faissUpsert_0.data.instance}}",
|
||||
"memory": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
|
||||
@@ -78,10 +78,10 @@
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
@@ -631,9 +631,9 @@
|
||||
"source": "ZepMemory_0",
|
||||
"sourceHandle": "ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-memory-BaseMemory",
|
||||
"type": "buttonedge",
|
||||
"id": "ZepMemory_0-ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"id": "ZepMemory_0-ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-memory-BaseMemory",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
|
||||
@@ -283,10 +283,10 @@
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
{
|
||||
"description": "Use Replicate API that runs Llama 13b v2 model with LLMChain",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 405,
|
||||
"id": "llmChain_1",
|
||||
"position": {
|
||||
"x": 967.581544453458,
|
||||
"y": 320.56761595884564
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "llmChain_1",
|
||||
"label": "LLM Chain",
|
||||
"name": "llmChain",
|
||||
"type": "LLMChain",
|
||||
"baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"],
|
||||
"category": "Chains",
|
||||
"description": "Chain to run queries against LLMs",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chain Name",
|
||||
"name": "chainName",
|
||||
"type": "string",
|
||||
"placeholder": "Name Your Chain",
|
||||
"optional": true,
|
||||
"id": "llmChain_1-input-chainName-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "llmChain_1-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Prompt",
|
||||
"name": "prompt",
|
||||
"type": "BasePromptTemplate",
|
||||
"id": "llmChain_1-input-prompt-BasePromptTemplate"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{replicate_0.data.instance}}",
|
||||
"prompt": "{{promptTemplate_0.data.instance}}",
|
||||
"chainName": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "llmChain_1-output-llmChain-LLMChain|BaseChain|BaseLangChain",
|
||||
"name": "llmChain",
|
||||
"label": "LLM Chain",
|
||||
"type": "LLMChain | BaseChain | BaseLangChain"
|
||||
},
|
||||
{
|
||||
"id": "llmChain_1-output-outputPrediction-string|json",
|
||||
"name": "outputPrediction",
|
||||
"label": "Output Prediction",
|
||||
"type": "string | json"
|
||||
}
|
||||
],
|
||||
"default": "llmChain"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"output": "llmChain"
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 967.581544453458,
|
||||
"y": 320.56761595884564
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 475,
|
||||
"id": "promptTemplate_0",
|
||||
"position": {
|
||||
"x": 269.2203229225663,
|
||||
"y": 129.02909641085535
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "promptTemplate_0",
|
||||
"label": "Prompt Template",
|
||||
"name": "promptTemplate",
|
||||
"type": "PromptTemplate",
|
||||
"baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"],
|
||||
"category": "Prompts",
|
||||
"description": "Schema to represent a basic prompt for an LLM",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Template",
|
||||
"name": "template",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"placeholder": "What is a good name for a company that makes {product}?",
|
||||
"id": "promptTemplate_0-input-template-string"
|
||||
},
|
||||
{
|
||||
"label": "Format Prompt Values",
|
||||
"name": "promptValues",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"list": true,
|
||||
"id": "promptTemplate_0-input-promptValues-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"template": "Assistant: You are a helpful assistant. You do not respond as 'User' or pretend to be 'User'. You only respond once as Assistant.\nUser: {query}\nAssistant:",
|
||||
"promptValues": "{\"query\":\"{{question}}\"}"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
||||
"name": "promptTemplate",
|
||||
"label": "PromptTemplate",
|
||||
"type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 269.2203229225663,
|
||||
"y": 129.02909641085535
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 527,
|
||||
"id": "replicate_0",
|
||||
"position": {
|
||||
"x": 607.4915400488668,
|
||||
"y": -60.643337207007804
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "replicate_0",
|
||||
"label": "Replicate",
|
||||
"name": "replicate",
|
||||
"type": "Replicate",
|
||||
"baseClasses": ["Replicate", "LLM", "BaseLLM", "BaseLanguageModel"],
|
||||
"category": "LLMs",
|
||||
"description": "Use Replicate to run open source models on cloud",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Replicate Api Key",
|
||||
"name": "replicateApiKey",
|
||||
"type": "password",
|
||||
"id": "replicate_0-input-replicateApiKey-password"
|
||||
},
|
||||
{
|
||||
"label": "Model",
|
||||
"name": "model",
|
||||
"type": "string",
|
||||
"placeholder": "a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5",
|
||||
"optional": true,
|
||||
"id": "replicate_0-input-model-string"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"description": "Adjusts randomness of outputs, greater than 1 is random and 0 is deterministic, 0.75 is a good starting value.",
|
||||
"default": 0.7,
|
||||
"optional": true,
|
||||
"id": "replicate_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"description": "Maximum number of tokens to generate. A word is generally 2-3 tokens",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "replicate_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"description": "When decoding text, samples from the top p percentage of most likely tokens; lower to ignore less likely tokens",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "replicate_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Repetition Penalty",
|
||||
"name": "repetitionPenalty",
|
||||
"type": "number",
|
||||
"description": "Penalty for repeated words in generated text; 1 is no penalty, values greater than 1 discourage repetition, less than 1 encourage it. (minimum: 0.01; maximum: 5)",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "replicate_0-input-repetitionPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Additional Inputs",
|
||||
"name": "additionalInputs",
|
||||
"type": "json",
|
||||
"description": "Each model has different parameters, refer to the specific model accepted inputs. For example: <a target=\"_blank\" href=\"https://replicate.com/a16z-infra/llama13b-v2-chat/api#inputs\">llama13b-v2</a>",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "replicate_0-input-additionalInputs-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"model": "a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5",
|
||||
"temperature": 0.7,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"repetitionPenalty": "",
|
||||
"additionalInputs": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "replicate_0-output-replicate-Replicate|LLM|BaseLLM|BaseLanguageModel",
|
||||
"name": "replicate",
|
||||
"label": "Replicate",
|
||||
"type": "Replicate | LLM | BaseLLM | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 607.4915400488668,
|
||||
"y": -60.643337207007804
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "promptTemplate_0",
|
||||
"sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
||||
"target": "llmChain_1",
|
||||
"targetHandle": "llmChain_1-input-prompt-BasePromptTemplate",
|
||||
"type": "buttonedge",
|
||||
"id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_1-llmChain_1-input-prompt-BasePromptTemplate",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "replicate_0",
|
||||
"sourceHandle": "replicate_0-output-replicate-Replicate|LLM|BaseLLM|BaseLanguageModel",
|
||||
"target": "llmChain_1",
|
||||
"targetHandle": "llmChain_1-input-model-BaseLanguageModel",
|
||||
"type": "buttonedge",
|
||||
"id": "replicate_0-replicate_0-output-replicate-Replicate|LLM|BaseLLM|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,122 +1,13 @@
|
||||
{
|
||||
"description": "Scrape web pages for QnA using conversational retrieval QA chain",
|
||||
"description": "Scrape web pages for QnA with long term memory Motorhead and return source documents",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 480,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 1574.2192193338556,
|
||||
"y": 334.4358233039927
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory",
|
||||
"optional": true,
|
||||
"description": "If no memory connected, default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}",
|
||||
"memory": "",
|
||||
"returnSourceDocuments": "",
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 1574.2192193338556,
|
||||
"y": 334.4358233039927
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 523,
|
||||
"height": 522,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 1184.1176114500388,
|
||||
"y": -44.15535835370571
|
||||
"x": 1509.7110310286191,
|
||||
"y": -171.0099374102956
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -257,19 +148,19 @@
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 1184.1176114500388,
|
||||
"y": -44.15535835370571
|
||||
"x": 1509.7110310286191,
|
||||
"y": -171.0099374102956
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 329,
|
||||
"height": 328,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 795.6162477805387,
|
||||
"y": 603.260214150876
|
||||
"x": 827.6835380475393,
|
||||
"y": 253.8955254525015
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -341,18 +232,18 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 795.6162477805387,
|
||||
"y": 603.260214150876
|
||||
"x": 827.6835380475393,
|
||||
"y": 253.8955254525015
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 555,
|
||||
"height": 554,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1191.1792786926865,
|
||||
"y": 514.2126330994578
|
||||
"x": 1178.0855412625938,
|
||||
"y": -1.6626550640073674
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -448,18 +339,18 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1191.1792786926865,
|
||||
"y": 514.2126330994578
|
||||
"x": 1178.0855412625938,
|
||||
"y": -1.6626550640073674
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 380,
|
||||
"height": 379,
|
||||
"id": "cheerioWebScraper_0",
|
||||
"position": {
|
||||
"x": 788.9349009610441,
|
||||
"y": 180.57790622561026
|
||||
"x": 829.4409518246235,
|
||||
"y": -168.78678247276423
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
@@ -528,9 +419,9 @@
|
||||
],
|
||||
"inputs": {
|
||||
"url": "https://www.itsjane.com",
|
||||
"textSplitter": "{{recursiveCharacterTextSplitter_0.data.instance}}",
|
||||
"relativeLinksMethod": "webCrawl",
|
||||
"limit": "0",
|
||||
"textSplitter": "{{htmlToMarkdownTextSplitter_0.data.instance}}",
|
||||
"relativeLinksMethod": "",
|
||||
"limit": "",
|
||||
"metadata": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
@@ -546,28 +437,34 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 788.9349009610441,
|
||||
"y": 180.57790622561026
|
||||
"x": 829.4409518246235,
|
||||
"y": -168.78678247276423
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 376,
|
||||
"id": "recursiveCharacterTextSplitter_0",
|
||||
"id": "htmlToMarkdownTextSplitter_0",
|
||||
"position": {
|
||||
"x": 406.08456707531263,
|
||||
"y": 197.66460328693972
|
||||
"x": 443.00626484042334,
|
||||
"y": 1.2942107707648631
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "recursiveCharacterTextSplitter_0",
|
||||
"label": "Recursive Character Text Splitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter",
|
||||
"baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"],
|
||||
"id": "htmlToMarkdownTextSplitter_0",
|
||||
"label": "HtmlToMarkdown Text Splitter",
|
||||
"name": "htmlToMarkdownTextSplitter",
|
||||
"type": "HtmlToMarkdownTextSplitter",
|
||||
"baseClasses": [
|
||||
"HtmlToMarkdownTextSplitter",
|
||||
"MarkdownTextSplitter",
|
||||
"RecursiveCharacterTextSplitter",
|
||||
"TextSplitter",
|
||||
"BaseDocumentTransformer"
|
||||
],
|
||||
"category": "Text Splitters",
|
||||
"description": "Split documents recursively by different characters - starting with \"\\n\\n\", then \"\\n\", then \" \"",
|
||||
"description": "Converts Html to Markdown and then split your content into documents based on the Markdown headers",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chunk Size",
|
||||
@@ -575,14 +472,14 @@
|
||||
"type": "number",
|
||||
"default": 1000,
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_0-input-chunkSize-number"
|
||||
"id": "htmlToMarkdownTextSplitter_0-input-chunkSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Chunk Overlap",
|
||||
"name": "chunkOverlap",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "recursiveCharacterTextSplitter_0-input-chunkOverlap-number"
|
||||
"id": "htmlToMarkdownTextSplitter_0-input-chunkOverlap-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
@@ -592,10 +489,10 @@
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"name": "recursiveCharacterTextSplitter",
|
||||
"label": "RecursiveCharacterTextSplitter",
|
||||
"type": "RecursiveCharacterTextSplitter | TextSplitter"
|
||||
"id": "htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer",
|
||||
"name": "htmlToMarkdownTextSplitter",
|
||||
"label": "HtmlToMarkdownTextSplitter",
|
||||
"type": "HtmlToMarkdownTextSplitter | MarkdownTextSplitter | RecursiveCharacterTextSplitter | TextSplitter | BaseDocumentTransformer"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
@@ -603,8 +500,195 @@
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 406.08456707531263,
|
||||
"y": 197.66460328693972
|
||||
"x": 443.00626484042334,
|
||||
"y": 1.2942107707648631
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 479,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 1882.5543981868987,
|
||||
"y": 305.08959224761225
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}",
|
||||
"memory": "{{motorheadMemory_0.data.instance}}",
|
||||
"returnSourceDocuments": true,
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1882.5543981868987,
|
||||
"y": 305.08959224761225
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 426,
|
||||
"id": "motorheadMemory_0",
|
||||
"position": {
|
||||
"x": 1515.4202055109095,
|
||||
"y": 539.7912360964175
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "motorheadMemory_0",
|
||||
"label": "Motorhead Memory",
|
||||
"name": "motorheadMemory",
|
||||
"type": "MotorheadMemory",
|
||||
"baseClasses": ["MotorheadMemory", "BaseChatMemory", "BaseMemory"],
|
||||
"category": "Memory",
|
||||
"description": "Use Motorhead Memory to store chat conversations",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"optional": true,
|
||||
"description": "Only needed when using hosted solution - https://getmetal.io",
|
||||
"credentialNames": ["motorheadMemoryApi"],
|
||||
"id": "motorheadMemory_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Base URL",
|
||||
"name": "baseURL",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "To use the online version, leave the URL blank. More details at https://getmetal.io.",
|
||||
"id": "motorheadMemory_0-input-baseURL-string"
|
||||
},
|
||||
{
|
||||
"label": "Session Id",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"description": "if empty, chatId will be used automatically",
|
||||
"default": "",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "motorheadMemory_0-input-sessionId-string"
|
||||
},
|
||||
{
|
||||
"label": "Memory Key",
|
||||
"name": "memoryKey",
|
||||
"type": "string",
|
||||
"default": "chat_history",
|
||||
"additionalParams": true,
|
||||
"id": "motorheadMemory_0-input-memoryKey-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"baseURL": "",
|
||||
"sessionId": "",
|
||||
"memoryKey": "chat_history"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory",
|
||||
"name": "motorheadMemory",
|
||||
"label": "MotorheadMemory",
|
||||
"type": "MotorheadMemory | BaseChatMemory | BaseMemory"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1515.4202055109095,
|
||||
"y": 539.7912360964175
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
@@ -622,12 +706,23 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"source": "cheerioWebScraper_0",
|
||||
"sourceHandle": "cheerioWebScraper_0-output-cheerioWebScraper-Document",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-document-Document",
|
||||
"type": "buttonedge",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"id": "cheerioWebScraper_0-cheerioWebScraper_0-output-cheerioWebScraper-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "htmlToMarkdownTextSplitter_0",
|
||||
"sourceHandle": "htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer",
|
||||
"target": "cheerioWebScraper_0",
|
||||
"targetHandle": "cheerioWebScraper_0-input-textSplitter-TextSplitter",
|
||||
"type": "buttonedge",
|
||||
"id": "htmlToMarkdownTextSplitter_0-htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer-cheerioWebScraper_0-cheerioWebScraper_0-input-textSplitter-TextSplitter",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
@@ -644,23 +739,23 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "recursiveCharacterTextSplitter_0",
|
||||
"sourceHandle": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"target": "cheerioWebScraper_0",
|
||||
"targetHandle": "cheerioWebScraper_0-input-textSplitter-TextSplitter",
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "recursiveCharacterTextSplitter_0-recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-cheerioWebScraper_0-cheerioWebScraper_0-input-textSplitter-TextSplitter",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "cheerioWebScraper_0",
|
||||
"sourceHandle": "cheerioWebScraper_0-output-cheerioWebScraper-Document",
|
||||
"target": "pineconeUpsert_0",
|
||||
"targetHandle": "pineconeUpsert_0-input-document-Document",
|
||||
"source": "motorheadMemory_0",
|
||||
"sourceHandle": "motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-memory-BaseMemory",
|
||||
"type": "buttonedge",
|
||||
"id": "cheerioWebScraper_0-cheerioWebScraper_0-output-cheerioWebScraper-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document",
|
||||
"id": "motorheadMemory_0-motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-memory-BaseMemory",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"ignore": ["**/*.spec.ts", ".git", "node_modules"],
|
||||
"watch": ["commands", "index.ts", "src"],
|
||||
"watch": ["commands", "index.ts", "src", "../components/nodes", "../components/src"],
|
||||
"exec": "yarn oclif-dev",
|
||||
"ext": "ts"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise",
|
||||
"version": "1.2.15",
|
||||
"version": "1.2.16",
|
||||
"description": "Flowiseai Server",
|
||||
"main": "dist/index",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -56,6 +56,8 @@
|
||||
"flowise-ui": "*",
|
||||
"moment-timezone": "^0.5.34",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql": "^2.18.1",
|
||||
"pg": "^8.11.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"socket.io": "^4.6.1",
|
||||
"sqlite3": "^5.1.6",
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import path from 'path'
|
||||
import { IChildProcessMessage, IReactFlowNode, IReactFlowObject, IRunChatflowMessageValue, INodeData } from './Interface'
|
||||
import { buildLangchain, constructGraphs, getEndingNode, getStartingNodes, getUserHome, resolveVariables } from './utils'
|
||||
import {
|
||||
buildLangchain,
|
||||
constructGraphs,
|
||||
getEndingNode,
|
||||
getStartingNodes,
|
||||
getUserHome,
|
||||
replaceInputsWithConfig,
|
||||
resolveVariables
|
||||
} from './utils'
|
||||
import { DataSource } from 'typeorm'
|
||||
import { ChatFlow } from './entity/ChatFlow'
|
||||
import { ChatMessage } from './entity/ChatMessage'
|
||||
@@ -110,6 +118,8 @@ export class ChildProcess {
|
||||
return
|
||||
}
|
||||
|
||||
if (incomingInput.overrideConfig)
|
||||
nodeToExecute.data = replaceInputsWithConfig(nodeToExecute.data, incomingInput.overrideConfig)
|
||||
const reactFlowNodeData: INodeData = resolveVariables(nodeToExecute.data, reactFlowNodes, incomingInput.question)
|
||||
nodeToExecuteData = reactFlowNodeData
|
||||
|
||||
@@ -143,14 +153,59 @@ export class ChildProcess {
|
||||
* @returns {DataSource}
|
||||
*/
|
||||
async function initDB() {
|
||||
const homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
const childAppDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize: true,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
let childAppDataSource
|
||||
let homePath
|
||||
const synchronize = process.env.OVERRIDE_DATABASE === 'false' ? false : true
|
||||
switch (process.env.DATABASE_TYPE) {
|
||||
case 'sqlite':
|
||||
homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
childAppDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
case 'mysql':
|
||||
childAppDataSource = new DataSource({
|
||||
type: 'mysql',
|
||||
host: process.env.DATABASE_HOST,
|
||||
port: parseInt(process.env.DATABASE_PORT || '3306'),
|
||||
username: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
charset: 'utf8mb4',
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
case 'postgres':
|
||||
childAppDataSource = new DataSource({
|
||||
type: 'postgres',
|
||||
host: process.env.DATABASE_HOST,
|
||||
port: parseInt(process.env.DATABASE_PORT || '5432'),
|
||||
username: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
default:
|
||||
homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
childAppDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
return await childAppDataSource.initialize()
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,57 @@ import { getUserHome } from './utils'
|
||||
let appDataSource: DataSource
|
||||
|
||||
export const init = async (): Promise<void> => {
|
||||
const homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
|
||||
appDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize: true,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
let homePath
|
||||
const synchronize = process.env.OVERRIDE_DATABASE === 'false' ? false : true
|
||||
switch (process.env.DATABASE_TYPE) {
|
||||
case 'sqlite':
|
||||
homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
appDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
case 'mysql':
|
||||
appDataSource = new DataSource({
|
||||
type: 'mysql',
|
||||
host: process.env.DATABASE_HOST,
|
||||
port: parseInt(process.env.DATABASE_PORT || '3306'),
|
||||
username: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
charset: 'utf8mb4',
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
case 'postgres':
|
||||
appDataSource = new DataSource({
|
||||
type: 'postgres',
|
||||
host: process.env.DATABASE_HOST,
|
||||
port: parseInt(process.env.DATABASE_PORT || '5432'),
|
||||
username: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
default:
|
||||
homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||
appDataSource = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: path.resolve(homePath, 'database.sqlite'),
|
||||
synchronize,
|
||||
entities: [ChatFlow, ChatMessage, Tool, Credential],
|
||||
migrations: []
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
export function getDataSource(): DataSource {
|
||||
|
||||
@@ -21,12 +21,21 @@ export default class Start extends Command {
|
||||
PORT: Flags.string(),
|
||||
PASSPHRASE: Flags.string(),
|
||||
DEBUG: Flags.string(),
|
||||
DATABASE_PATH: Flags.string(),
|
||||
APIKEY_PATH: Flags.string(),
|
||||
SECRETKEY_PATH: Flags.string(),
|
||||
LOG_PATH: Flags.string(),
|
||||
LOG_LEVEL: Flags.string(),
|
||||
EXECUTION_MODE: Flags.string()
|
||||
EXECUTION_MODE: Flags.string(),
|
||||
TOOL_FUNCTION_BUILTIN_DEP: Flags.string(),
|
||||
TOOL_FUNCTION_EXTERNAL_DEP: Flags.string(),
|
||||
OVERRIDE_DATABASE: Flags.string(),
|
||||
DATABASE_TYPE: Flags.string(),
|
||||
DATABASE_PATH: Flags.string(),
|
||||
DATABASE_PORT: Flags.string(),
|
||||
DATABASE_HOST: Flags.string(),
|
||||
DATABASE_NAME: Flags.string(),
|
||||
DATABASE_USER: Flags.string(),
|
||||
DATABASE_PASSWORD: Flags.string()
|
||||
}
|
||||
|
||||
async stopProcess() {
|
||||
@@ -58,18 +67,38 @@ export default class Start extends Command {
|
||||
})
|
||||
|
||||
const { flags } = await this.parse(Start)
|
||||
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
|
||||
if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD
|
||||
|
||||
if (flags.PORT) process.env.PORT = flags.PORT
|
||||
if (flags.PASSPHRASE) process.env.PASSPHRASE = flags.PASSPHRASE
|
||||
if (flags.DATABASE_PATH) process.env.DATABASE_PATH = flags.DATABASE_PATH
|
||||
if (flags.APIKEY_PATH) process.env.APIKEY_PATH = flags.APIKEY_PATH
|
||||
if (flags.SECRETKEY_PATH) process.env.SECRETKEY_PATH = flags.SECRETKEY_PATH
|
||||
if (flags.LOG_PATH) process.env.LOG_PATH = flags.LOG_PATH
|
||||
if (flags.LOG_LEVEL) process.env.LOG_LEVEL = flags.LOG_LEVEL
|
||||
if (flags.EXECUTION_MODE) process.env.EXECUTION_MODE = flags.EXECUTION_MODE
|
||||
if (flags.DEBUG) process.env.DEBUG = flags.DEBUG
|
||||
|
||||
// Authorization
|
||||
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
|
||||
if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD
|
||||
if (flags.APIKEY_PATH) process.env.APIKEY_PATH = flags.APIKEY_PATH
|
||||
|
||||
// Credentials
|
||||
if (flags.PASSPHRASE) process.env.PASSPHRASE = flags.PASSPHRASE
|
||||
if (flags.SECRETKEY_PATH) process.env.SECRETKEY_PATH = flags.SECRETKEY_PATH
|
||||
|
||||
// Logs
|
||||
if (flags.LOG_PATH) process.env.LOG_PATH = flags.LOG_PATH
|
||||
if (flags.LOG_LEVEL) process.env.LOG_LEVEL = flags.LOG_LEVEL
|
||||
|
||||
// Tool functions
|
||||
if (flags.TOOL_FUNCTION_BUILTIN_DEP) process.env.TOOL_FUNCTION_BUILTIN_DEP = flags.TOOL_FUNCTION_BUILTIN_DEP
|
||||
if (flags.TOOL_FUNCTION_EXTERNAL_DEP) process.env.TOOL_FUNCTION_EXTERNAL_DEP = flags.TOOL_FUNCTION_EXTERNAL_DEP
|
||||
|
||||
// Database config
|
||||
if (flags.OVERRIDE_DATABASE) process.env.OVERRIDE_DATABASE = flags.OVERRIDE_DATABASE
|
||||
if (flags.DATABASE_TYPE) process.env.DATABASE_TYPE = flags.DATABASE_TYPE
|
||||
if (flags.DATABASE_PATH) process.env.DATABASE_PATH = flags.DATABASE_PATH
|
||||
if (flags.DATABASE_PORT) process.env.DATABASE_PORT = flags.DATABASE_PORT
|
||||
if (flags.DATABASE_HOST) process.env.DATABASE_HOST = flags.DATABASE_HOST
|
||||
if (flags.DATABASE_NAME) process.env.DATABASE_NAME = flags.DATABASE_NAME
|
||||
if (flags.DATABASE_USER) process.env.DATABASE_USER = flags.DATABASE_USER
|
||||
if (flags.DATABASE_PASSWORD) process.env.DATABASE_PASSWORD = flags.DATABASE_PASSWORD
|
||||
|
||||
await (async () => {
|
||||
try {
|
||||
logger.info('Starting Flowise...')
|
||||
|
||||
@@ -10,7 +10,7 @@ export class ChatFlow implements IChatFlow {
|
||||
@Column()
|
||||
name: string
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'text' })
|
||||
flowData: string
|
||||
|
||||
@Column({ nullable: true })
|
||||
|
||||
@@ -14,7 +14,7 @@ export class ChatMessage implements IChatMessage {
|
||||
@Column()
|
||||
chatflowid: string
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'text' })
|
||||
content: string
|
||||
|
||||
@Column({ nullable: true })
|
||||
|
||||
@@ -10,7 +10,7 @@ export class Tool implements ITool {
|
||||
@Column()
|
||||
name: string
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'text' })
|
||||
description: string
|
||||
|
||||
@Column()
|
||||
|
||||
@@ -42,7 +42,9 @@ import {
|
||||
databaseEntities,
|
||||
getApiKey,
|
||||
transformToCredentialEntity,
|
||||
decryptCredentialData
|
||||
decryptCredentialData,
|
||||
clearSessionMemory,
|
||||
replaceInputsWithConfig
|
||||
} from './utils'
|
||||
import { cloneDeep, omit } from 'lodash'
|
||||
import { getDataSource } from './DataSource'
|
||||
@@ -63,9 +65,6 @@ export class App {
|
||||
|
||||
constructor() {
|
||||
this.app = express()
|
||||
|
||||
// Add the expressRequestLogger middleware to log all requests
|
||||
this.app.use(expressRequestLogger)
|
||||
}
|
||||
|
||||
async initDatabase() {
|
||||
@@ -97,6 +96,9 @@ export class App {
|
||||
// Allow access from *
|
||||
this.app.use(cors())
|
||||
|
||||
// Add the expressRequestLogger middleware to log all requests
|
||||
this.app.use(expressRequestLogger)
|
||||
|
||||
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
|
||||
const username = process.env.FLOWISE_USERNAME
|
||||
const password = process.env.FLOWISE_PASSWORD
|
||||
@@ -362,8 +364,13 @@ export class App {
|
||||
|
||||
// Get all chatmessages from chatflowid
|
||||
this.app.get('/api/v1/chatmessage/:id', async (req: Request, res: Response) => {
|
||||
const chatmessages = await this.AppDataSource.getRepository(ChatMessage).findBy({
|
||||
chatflowid: req.params.id
|
||||
const chatmessages = await this.AppDataSource.getRepository(ChatMessage).find({
|
||||
where: {
|
||||
chatflowid: req.params.id
|
||||
},
|
||||
order: {
|
||||
createdDate: 'ASC'
|
||||
}
|
||||
})
|
||||
return res.json(chatmessages)
|
||||
})
|
||||
@@ -382,6 +389,19 @@ export class App {
|
||||
|
||||
// Delete all chatmessages from chatflowid
|
||||
this.app.delete('/api/v1/chatmessage/:id', async (req: Request, res: Response) => {
|
||||
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
|
||||
id: req.params.id
|
||||
})
|
||||
if (!chatflow) {
|
||||
res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||
return
|
||||
}
|
||||
const flowData = chatflow.flowData
|
||||
const parsedFlowData: IReactFlowObject = JSON.parse(flowData)
|
||||
const nodes = parsedFlowData.nodes
|
||||
let chatId = await getChatId(chatflow.id)
|
||||
if (!chatId) chatId = chatflow.id
|
||||
clearSessionMemory(nodes, this.nodesPool.componentNodes, chatId, req.query.sessionId as string)
|
||||
const results = await this.AppDataSource.getRepository(ChatMessage).delete({ chatflowid: req.params.id })
|
||||
return res.json(results)
|
||||
})
|
||||
@@ -630,6 +650,8 @@ export class App {
|
||||
}
|
||||
templates.push(template)
|
||||
})
|
||||
const FlowiseDocsQnA = templates.find((tmp) => tmp.name === 'Flowise Docs QnA')
|
||||
if (FlowiseDocsQnA) templates.unshift(FlowiseDocsQnA)
|
||||
return res.json(templates)
|
||||
})
|
||||
|
||||
@@ -809,7 +831,7 @@ export class App {
|
||||
if (!chatflow) return res.status(404).send(`Chatflow ${chatflowid} not found`)
|
||||
|
||||
let chatId = await getChatId(chatflow.id)
|
||||
if (!chatId) chatId = Date.now().toString()
|
||||
if (!chatId) chatId = chatflowid
|
||||
|
||||
if (!isInternal) {
|
||||
await this.validateKey(req, res, chatflow)
|
||||
@@ -941,6 +963,8 @@ export class App {
|
||||
const nodeToExecute = reactFlowNodes.find((node: IReactFlowNode) => node.id === endingNodeId)
|
||||
if (!nodeToExecute) return res.status(404).send(`Node ${endingNodeId} not found`)
|
||||
|
||||
if (incomingInput.overrideConfig)
|
||||
nodeToExecute.data = replaceInputsWithConfig(nodeToExecute.data, incomingInput.overrideConfig)
|
||||
const reactFlowNodeData: INodeData = resolveVariables(nodeToExecute.data, reactFlowNodes, incomingInput.question)
|
||||
nodeToExecuteData = reactFlowNodeData
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ dotenv.config({ path: path.join(__dirname, '..', '..', '.env'), override: true }
|
||||
|
||||
// default config
|
||||
const loggingConfig = {
|
||||
dir: process.env.LOG_PATH ?? path.join(__dirname, '..', '..', '..', '..', 'logs'),
|
||||
dir: process.env.LOG_PATH ?? path.join(__dirname, '..', '..', 'logs'),
|
||||
server: {
|
||||
level: process.env.LOG_LEVEL ?? 'info',
|
||||
filename: 'server.log',
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
ICredentialReqBody
|
||||
} from '../Interface'
|
||||
import { cloneDeep, get, omit, merge } from 'lodash'
|
||||
import { ICommonObject, getInputVariables, IDatabaseEntity } from 'flowise-components'
|
||||
import { ICommonObject, getInputVariables, IDatabaseEntity, handleEscapeCharacters } from 'flowise-components'
|
||||
import { scryptSync, randomBytes, timingSafeEqual } from 'crypto'
|
||||
import { lib, PBKDF2, AES, enc } from 'crypto-js'
|
||||
|
||||
@@ -281,6 +281,29 @@ export const buildLangchain = async (
|
||||
return flowNodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear memory
|
||||
* @param {IReactFlowNode[]} reactFlowNodes
|
||||
* @param {IComponentNodes} componentNodes
|
||||
* @param {string} chatId
|
||||
* @param {string} sessionId
|
||||
*/
|
||||
export const clearSessionMemory = async (
|
||||
reactFlowNodes: IReactFlowNode[],
|
||||
componentNodes: IComponentNodes,
|
||||
chatId: string,
|
||||
sessionId?: string
|
||||
) => {
|
||||
for (const node of reactFlowNodes) {
|
||||
if (node.data.category !== 'Memory') continue
|
||||
const nodeInstanceFilePath = componentNodes[node.data.name].filePath as string
|
||||
const nodeModule = await import(nodeInstanceFilePath)
|
||||
const newNodeInstance = new nodeModule.nodeClass()
|
||||
if (sessionId && node.data.inputs) node.data.inputs.sessionId = sessionId
|
||||
if (newNodeInstance.clearSessionMemory) await newNodeInstance?.clearSessionMemory(node.data, { chatId })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get variable value from outputResponses.output
|
||||
* @param {string} paramValue
|
||||
@@ -310,8 +333,13 @@ export const getVariableValue = (paramValue: string, reactFlowNodes: IReactFlowN
|
||||
const variableEndIdx = startIdx
|
||||
const variableFullPath = returnVal.substring(variableStartIdx, variableEndIdx)
|
||||
|
||||
/**
|
||||
* Apply string transformation to convert special chars:
|
||||
* FROM: hello i am ben\n\n\thow are you?
|
||||
* TO: hello i am benFLOWISE_NEWLINEFLOWISE_NEWLINEFLOWISE_TABhow are you?
|
||||
*/
|
||||
if (isAcceptVariable && variableFullPath === QUESTION_VAR_PREFIX) {
|
||||
variableDict[`{{${variableFullPath}}}`] = question
|
||||
variableDict[`{{${variableFullPath}}}`] = handleEscapeCharacters(question, false)
|
||||
}
|
||||
|
||||
// Split by first occurrence of '.' to get just nodeId
|
||||
@@ -414,7 +442,11 @@ export const replaceInputsWithConfig = (flowNodeData: INodeData, overrideConfig:
|
||||
|
||||
const getParamValues = (paramsObj: ICommonObject) => {
|
||||
for (const config in overrideConfig) {
|
||||
paramsObj[config] = overrideConfig[config]
|
||||
let paramValue = overrideConfig[config] ?? paramsObj[config]
|
||||
// Check if boolean
|
||||
if (paramValue === 'true') paramValue = true
|
||||
else if (paramValue === 'false') paramValue = false
|
||||
paramsObj[config] = paramValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +762,7 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
|
||||
isValidChainOrAgent = !blacklistChains.includes(endingNodeData.name)
|
||||
} else if (endingNodeData.category === 'Agents') {
|
||||
// Agent that are available to stream
|
||||
const whitelistAgents = ['openAIFunctionAgent']
|
||||
const whitelistAgents = ['openAIFunctionAgent', 'csvAgent', 'airtableAgent']
|
||||
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,44 +57,47 @@ const logger = createLogger({
|
||||
* this.app.use(expressRequestLogger)
|
||||
*/
|
||||
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
||||
const fileLogger = createLogger({
|
||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||
defaultMeta: {
|
||||
package: 'server',
|
||||
request: {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
body: req.body,
|
||||
query: req.query,
|
||||
params: req.params,
|
||||
headers: req.headers
|
||||
}
|
||||
},
|
||||
transports: [
|
||||
new transports.File({
|
||||
filename: path.join(logDir, config.logging.express.filename ?? 'server-requests.log.jsonl'),
|
||||
level: config.logging.express.level ?? 'debug'
|
||||
})
|
||||
]
|
||||
})
|
||||
const unwantedLogURLs = ['/api/v1/node-icon/']
|
||||
if (req.url.includes('/api/v1/') && !unwantedLogURLs.some((url) => req.url.includes(url))) {
|
||||
const fileLogger = createLogger({
|
||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||
defaultMeta: {
|
||||
package: 'server',
|
||||
request: {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
body: req.body,
|
||||
query: req.query,
|
||||
params: req.params,
|
||||
headers: req.headers
|
||||
}
|
||||
},
|
||||
transports: [
|
||||
new transports.File({
|
||||
filename: path.join(logDir, config.logging.express.filename ?? 'server-requests.log.jsonl'),
|
||||
level: config.logging.express.level ?? 'debug'
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
const getRequestEmoji = (method: string) => {
|
||||
const requetsEmojis: Record<string, string> = {
|
||||
GET: '⬇️',
|
||||
POST: '⬆️',
|
||||
PUT: '🖊',
|
||||
DELETE: '❌',
|
||||
OPTION: '🔗'
|
||||
const getRequestEmoji = (method: string) => {
|
||||
const requetsEmojis: Record<string, string> = {
|
||||
GET: '⬇️',
|
||||
POST: '⬆️',
|
||||
PUT: '🖊',
|
||||
DELETE: '❌',
|
||||
OPTION: '🔗'
|
||||
}
|
||||
|
||||
return requetsEmojis[method] || '?'
|
||||
}
|
||||
|
||||
return requetsEmojis[method] || '?'
|
||||
}
|
||||
|
||||
if (req.method !== 'GET') {
|
||||
fileLogger.info(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
logger.info(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
} else {
|
||||
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
if (req.method !== 'GET') {
|
||||
fileLogger.info(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
logger.info(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
} else {
|
||||
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
|
||||
Reference in New Issue
Block a user