add Zapier NLP

This commit is contained in:
chungyau97 2023-05-16 21:44:39 +07:00
parent 3e4278e4fe
commit 2719c886cf
5 changed files with 13 additions and 10 deletions

View File

@ -66,7 +66,8 @@ class AutoGPT_Agents implements INode {
async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseChatModel
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever as VectorStoreRetriever
const tools = nodeData.inputs?.tools as Tool[]
let tools = nodeData.inputs?.tools as Tool[]
tools = tools.flat()
const aiName = (nodeData.inputs?.aiName as string) || 'AutoGPT'
const aiRole = (nodeData.inputs?.aiRole as string) || 'Assistant'
const maxLoop = nodeData.inputs?.maxLoop as string

View File

@ -62,7 +62,8 @@ class ConversationalAgent_Agents implements INode {
async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseChatModel
const tools = nodeData.inputs?.tools as Tool[]
let tools = nodeData.inputs?.tools as Tool[]
tools = tools.flat()
const memory = nodeData.inputs?.memory as BaseChatMemory
const humanMessage = nodeData.inputs?.humanMessage as string
const systemMessage = nodeData.inputs?.systemMessage as string

View File

@ -39,7 +39,8 @@ class MRKLAgentChat_Agents implements INode {
async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseChatModel
const tools = nodeData.inputs?.tools as Tool[]
let tools = nodeData.inputs?.tools as Tool[]
tools = tools.flat()
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'chat-zero-shot-react-description',
verbose: true

View File

@ -26,7 +26,7 @@ class MRKLAgentLLM_Agents implements INode {
{
label: 'Allowed Tools',
name: 'tools',
type: 'Tool' || 'Tool[]',
type: 'Tool',
list: true
},
{
@ -39,8 +39,9 @@ class MRKLAgentLLM_Agents implements INode {
async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseLLM
const tools = nodeData.inputs?.tools as Tool[]
console.log(`something about tools: ${JSON.stringify(tools)}`)
let tools = nodeData.inputs?.tools as Tool[]
tools = tools.flat()
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'zero-shot-react-description',
verbose: true

View File

@ -1,7 +1,6 @@
import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools'
import { INode, INodeData, INodeParams } from '../../../src/Interface'
import { getBaseClasses } from '../../../src/utils'
import { ZapierToolKit, createSqlAgent } from 'langchain/agents'
import { ZapierToolKit } from 'langchain/agents'
class ZapierNLA_Tools implements INode {
label: string
@ -19,7 +18,7 @@ class ZapierNLA_Tools implements INode {
this.type = 'ZapierNLA'
this.icon = 'zapier.png'
this.category = 'Tools'
this.description = 'Access to apps and actions on Zapier&#39;s platform through a natural language API interface'
this.description = "Access to apps and actions on Zapier's platform through a natural language API interface"
this.inputs = [
{
label: 'Zapier NLA Api Key',
@ -27,7 +26,7 @@ class ZapierNLA_Tools implements INode {
type: 'password'
}
]
this.baseClasses = [this.type, ...getBaseClasses(ZapierNLAWrapper)]
this.baseClasses = [this.type, 'Tool']
}
async init(nodeData: INodeData): Promise<any> {