mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
add vector stores
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { ChainTool } from 'langchain/tools'
|
||||
import { BaseChain } from 'langchain/chains'
|
||||
|
||||
class ChainTool_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Chain Tool'
|
||||
this.name = 'chainTool'
|
||||
this.type = 'ChainTool'
|
||||
this.icon = 'chaintool.svg'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Use a chain as allowed tool for agent'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(ChainTool)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Chain Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
placeholder: 'state-of-union-qa'
|
||||
},
|
||||
{
|
||||
label: 'Chain Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
rows: 3,
|
||||
placeholder:
|
||||
'State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.'
|
||||
},
|
||||
{
|
||||
label: 'Return Direct',
|
||||
name: 'returnDirect',
|
||||
type: 'boolean',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Base Chain',
|
||||
name: 'baseChain',
|
||||
type: 'BaseChain'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const name = nodeData.inputs?.name as string
|
||||
const description = nodeData.inputs?.description as string
|
||||
const baseChain = nodeData.inputs?.baseChain as BaseChain
|
||||
const returnDirect = nodeData.inputs?.returnDirect as boolean
|
||||
|
||||
const obj = {
|
||||
name,
|
||||
description,
|
||||
chain: baseChain
|
||||
} as any
|
||||
|
||||
if (returnDirect) obj.returnDirect = returnDirect
|
||||
|
||||
const tool = new ChainTool(obj)
|
||||
|
||||
return tool
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: ChainTool_Tools }
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-tool" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M7 10h3v-3l-3.5 -3.5a6 6 0 0 1 8 8l6 6a2 2 0 0 1 -3 3l-6 -6a6 6 0 0 1 -8 -8l3.5 3.5"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 396 B |
Reference in New Issue
Block a user