add Zapier NLP
This commit is contained in:
parent
3e4278e4fe
commit
2719c886cf
|
|
@ -66,7 +66,8 @@ class AutoGPT_Agents implements INode {
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
const model = nodeData.inputs?.model as BaseChatModel
|
const model = nodeData.inputs?.model as BaseChatModel
|
||||||
const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever as VectorStoreRetriever
|
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 aiName = (nodeData.inputs?.aiName as string) || 'AutoGPT'
|
||||||
const aiRole = (nodeData.inputs?.aiRole as string) || 'Assistant'
|
const aiRole = (nodeData.inputs?.aiRole as string) || 'Assistant'
|
||||||
const maxLoop = nodeData.inputs?.maxLoop as string
|
const maxLoop = nodeData.inputs?.maxLoop as string
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ class ConversationalAgent_Agents implements INode {
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
const model = nodeData.inputs?.model as BaseChatModel
|
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 memory = nodeData.inputs?.memory as BaseChatMemory
|
||||||
const humanMessage = nodeData.inputs?.humanMessage as string
|
const humanMessage = nodeData.inputs?.humanMessage as string
|
||||||
const systemMessage = nodeData.inputs?.systemMessage as string
|
const systemMessage = nodeData.inputs?.systemMessage as string
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ class MRKLAgentChat_Agents implements INode {
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
const model = nodeData.inputs?.model as BaseChatModel
|
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, {
|
const executor = await initializeAgentExecutorWithOptions(tools, model, {
|
||||||
agentType: 'chat-zero-shot-react-description',
|
agentType: 'chat-zero-shot-react-description',
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class MRKLAgentLLM_Agents implements INode {
|
||||||
{
|
{
|
||||||
label: 'Allowed Tools',
|
label: 'Allowed Tools',
|
||||||
name: 'tools',
|
name: 'tools',
|
||||||
type: 'Tool' || 'Tool[]',
|
type: 'Tool',
|
||||||
list: true
|
list: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -39,8 +39,9 @@ class MRKLAgentLLM_Agents implements INode {
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
const model = nodeData.inputs?.model as BaseLLM
|
const model = nodeData.inputs?.model as BaseLLM
|
||||||
const tools = nodeData.inputs?.tools as Tool[]
|
let tools = nodeData.inputs?.tools as Tool[]
|
||||||
console.log(`something about tools: ${JSON.stringify(tools)}`)
|
tools = tools.flat()
|
||||||
|
|
||||||
const executor = await initializeAgentExecutorWithOptions(tools, model, {
|
const executor = await initializeAgentExecutorWithOptions(tools, model, {
|
||||||
agentType: 'zero-shot-react-description',
|
agentType: 'zero-shot-react-description',
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools'
|
import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools'
|
||||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses } from '../../../src/utils'
|
import { ZapierToolKit } from 'langchain/agents'
|
||||||
import { ZapierToolKit, createSqlAgent } from 'langchain/agents'
|
|
||||||
|
|
||||||
class ZapierNLA_Tools implements INode {
|
class ZapierNLA_Tools implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|
@ -19,7 +18,7 @@ class ZapierNLA_Tools implements INode {
|
||||||
this.type = 'ZapierNLA'
|
this.type = 'ZapierNLA'
|
||||||
this.icon = 'zapier.png'
|
this.icon = 'zapier.png'
|
||||||
this.category = 'Tools'
|
this.category = 'Tools'
|
||||||
this.description = 'Access to apps and actions on Zapier'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 = [
|
this.inputs = [
|
||||||
{
|
{
|
||||||
label: 'Zapier NLA Api Key',
|
label: 'Zapier NLA Api Key',
|
||||||
|
|
@ -27,7 +26,7 @@ class ZapierNLA_Tools implements INode {
|
||||||
type: 'password'
|
type: 'password'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
this.baseClasses = [this.type, ...getBaseClasses(ZapierNLAWrapper)]
|
this.baseClasses = [this.type, 'Tool']
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue