Merge branch 'main' into vectara-upload-files

This commit is contained in:
Seif
2023-09-15 07:24:40 -07:00
committed by GitHub
48 changed files with 820 additions and 99 deletions
@@ -3,7 +3,7 @@ import { getBaseClasses } from '../../../src/utils'
import { VectorDBQAChain } from 'langchain/chains'
import { BaseLanguageModel } from 'langchain/base_language'
import { VectorStore } from 'langchain/vectorstores/base'
import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler'
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
class VectorDBQAChain_Chains implements INode {
label: string
@@ -57,13 +57,14 @@ class VectorDBQAChain_Chains implements INode {
}
const loggerHandler = new ConsoleCallbackHandler(options.logger)
const callbacks = await additionalCallbacks(nodeData, options)
if (options.socketIO && options.socketIOClientId) {
const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId)
const res = await chain.call(obj, [loggerHandler, handler])
const res = await chain.call(obj, [loggerHandler, handler, ...callbacks])
return res?.text
} else {
const res = await chain.call(obj, [loggerHandler])
const res = await chain.call(obj, [loggerHandler, ...callbacks])
return res?.text
}
}