add debug

This commit is contained in:
Henry
2023-05-19 18:20:41 +01:00
parent fb400cbfbc
commit 1f4efd6734
12 changed files with 28 additions and 10 deletions
+1
View File
@@ -0,0 +1 @@
DEBUG=true
+8
View File
@@ -12,6 +12,14 @@ Install:
npm i flowise-components
```
## Debug
To view all the logs, create an `.env` file and add:
```
DEBUG=true
```
## License
Source code in this repository is made available under the [MIT License](https://github.com/FlowiseAI/Flowise/blob/master/LICENSE.md).
@@ -70,7 +70,7 @@ class ConversationalAgent_Agents implements INode {
const obj: InitializeAgentExecutorOptions = {
agentType: 'chat-conversational-react-description',
verbose: true
verbose: process.env.DEBUG === 'true' ? true : false
}
const agentArgs: any = {}
@@ -43,7 +43,7 @@ class MRKLAgentChat_Agents implements INode {
tools = tools.flat()
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'chat-zero-shot-react-description',
verbose: true
verbose: process.env.DEBUG === 'true' ? true : false
})
return executor
}
@@ -44,7 +44,7 @@ class MRKLAgentLLM_Agents implements INode {
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'zero-shot-react-description',
verbose: true
verbose: process.env.DEBUG === 'true' ? true : false
})
return executor
}
@@ -40,7 +40,9 @@ class ConversationalRetrievalQAChain_Chains implements INode {
const model = nodeData.inputs?.model as BaseLanguageModel
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever as BaseRetriever
const chain = ConversationalRetrievalQAChain.fromLLM(model, vectorStoreRetriever)
const chain = ConversationalRetrievalQAChain.fromLLM(model, vectorStoreRetriever, {
verbose: process.env.DEBUG === 'true' ? true : false
})
return chain
}
@@ -62,10 +62,10 @@ class LLMChain_Chains implements INode {
const promptValues = prompt.promptValues as ICommonObject
if (output === this.name) {
const chain = new LLMChain({ llm: model, prompt })
const chain = new LLMChain({ llm: model, prompt, verbose: process.env.DEBUG === 'true' ? true : false })
return chain
} else if (output === 'outputPrediction') {
const chain = new LLMChain({ llm: model, prompt })
const chain = new LLMChain({ llm: model, prompt, verbose: process.env.DEBUG === 'true' ? true : false })
const inputVariables = chain.prompt.inputVariables as string[] // ["product"]
const res = await runPrediction(inputVariables, chain, input, promptValues)
// eslint-disable-next-line no-console
@@ -40,7 +40,7 @@ class RetrievalQAChain_Chains implements INode {
const model = nodeData.inputs?.model as BaseLanguageModel
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever as BaseRetriever
const chain = RetrievalQAChain.fromLLM(model, vectorStoreRetriever)
const chain = RetrievalQAChain.fromLLM(model, vectorStoreRetriever, { verbose: process.env.DEBUG === 'true' ? true : false })
return chain
}
@@ -82,7 +82,8 @@ const getSQLDBChain = async (databaseType: 'sqlite', dbFilePath: string, llm: Ba
const obj: SqlDatabaseChainInput = {
llm,
database: db
database: db,
verbose: process.env.DEBUG === 'true' ? true : false
}
const chain = new SqlDatabaseChain(obj)
@@ -40,7 +40,7 @@ class VectorDBQAChain_Chains implements INode {
const model = nodeData.inputs?.model as BaseLanguageModel
const vectorStore = nodeData.inputs?.vectorStore as VectorStore
const chain = VectorDBQAChain.fromLLM(model, vectorStore)
const chain = VectorDBQAChain.fromLLM(model, vectorStore, { verbose: process.env.DEBUG === 'true' ? true : false })
return chain
}
+1 -1
View File
@@ -29,7 +29,7 @@
"express": "^4.17.3",
"form-data": "^4.0.0",
"graphql": "^16.6.0",
"langchain": "^0.0.73",
"langchain": "^0.0.78",
"linkifyjs": "^4.1.1",
"mammoth": "^1.5.1",
"moment": "^2.29.3",
+6
View File
@@ -1,2 +1,8 @@
import dotenv from 'dotenv'
import path from 'path'
const envPath = path.join(__dirname, '..', '..', '.env')
dotenv.config({ path: envPath })
export * from './Interface'
export * from './utils'