Chore/LC v0.3 (#3517)

* bump langchain version to 0.3, upgrades on all chat models

* update all docs loader to have documents and text output options

* fix pnpm lock file
This commit is contained in:
Henry Heng
2024-11-28 11:06:12 +00:00
committed by GitHub
parent 126808b62a
commit 940c8fd3b0
82 changed files with 2373 additions and 1540 deletions
@@ -92,11 +92,11 @@ export const utilGetUploadsConfig = async (chatflowid: string): Promise<IUploadC
'supervisor',
'seqStart'
]
const imgUploadLLMNodes = ['chatOpenAI', 'chatAnthropic', 'awsChatBedrock', 'azureChatOpenAI', 'chatGoogleGenerativeAI', 'chatOllama']
if (nodes.some((node) => imgUploadAllowedNodes.includes(node.data.name))) {
nodes.forEach((node: IReactFlowNode) => {
if (imgUploadLLMNodes.indexOf(node.data.name) > -1) {
const data = node.data
if (data.category === 'Chat Models' && data.inputs?.['allowImageUploads'] === true) {
// TODO: for now the maxUploadSize is hardcoded to 5MB, we need to add it to the node properties
node.data.inputParams.map((param: INodeParams) => {
if (param.name === 'allowImageUploads' && node.data.inputs?.['allowImageUploads']) {
+14 -24
View File
@@ -1269,6 +1269,7 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
* @returns {boolean}
*/
export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNodeData: INodeData) => {
/** Deprecated, add streaming input param to the component instead **/
const streamAvailableLLMs = {
'Chat Models': [
'azureChatOpenAI',
@@ -1299,9 +1300,18 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
for (const flowNode of reactFlowNodes) {
const data = flowNode.data
if (data.category === 'Chat Models' || data.category === 'LLMs') {
isChatOrLLMsExist = true
const validLLMs = streamAvailableLLMs[data.category]
if (!validLLMs.includes(data.name)) return false
if (data.inputs?.streaming === false || data.inputs?.streaming === 'false') {
return false
}
if (data.inputs?.streaming === true || data.inputs?.streaming === 'true') {
isChatOrLLMsExist = true // passed, proceed to next check
}
/** Deprecated, add streaming input param to the component instead **/
if (!Object.prototype.hasOwnProperty.call(data.inputs, 'streaming') && !data.inputs?.streaming) {
isChatOrLLMsExist = true
const validLLMs = streamAvailableLLMs[data.category]
if (!validLLMs.includes(data.name)) return false
}
}
}
@@ -1312,29 +1322,9 @@ 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',
'mistralAIToolAgent',
'csvAgent',
'airtableAgent',
'conversationalRetrievalAgent',
'openAIToolAgent',
'toolAgent',
'conversationalRetrievalToolAgent',
'openAIToolAgentLlamaIndex'
]
const whitelistAgents = ['csvAgent', 'airtableAgent', 'toolAgent', 'conversationalRetrievalToolAgent', 'openAIToolAgentLlamaIndex']
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)
// Anthropic streaming has some bug where the log is being sent, temporarily disabled
const model = endingNodeData.inputs?.model
if (endingNodeData.name.includes('toolAgent')) {
if (typeof model === 'string' && model.includes('chatAnthropic')) {
return false
} else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) {
return false
}
}
// If agent is openAIAssistant, streaming is enabled
if (endingNodeData.name === 'openAIAssistant') return true
} else if (endingNodeData.category === 'Engine') {