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
@@ -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
}