Merge pull request #114 from FlowiseAI/feature/Zapier

This commit is contained in:
Ong Chung Yau
2023-05-16 23:01:17 +07:00
committed by GitHub
7 changed files with 327 additions and 4 deletions
@@ -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
@@ -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
@@ -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
@@ -39,7 +39,8 @@ 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[]
let tools = nodeData.inputs?.tools as Tool[]
tools = tools.flat()
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'zero-shot-react-description',
@@ -0,0 +1,45 @@
import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools'
import { INode, INodeData, INodeParams } from '../../../src/Interface'
import { ZapierToolKit } from 'langchain/agents'
class ZapierNLA_Tools implements INode {
label: string
name: string
description: string
type: string
icon: string
category: string
baseClasses: string[]
inputs: INodeParams[]
constructor() {
this.label = 'Zapier NLA'
this.name = 'zapierNLA'
this.type = 'ZapierNLA'
this.icon = 'zapier.png'
this.category = 'Tools'
this.description = "Access to apps and actions on Zapier's platform through a natural language API interface"
this.inputs = [
{
label: 'Zapier NLA Api Key',
name: 'apiKey',
type: 'password'
}
]
this.baseClasses = [this.type, 'Tool']
}
async init(nodeData: INodeData): Promise<any> {
const apiKey = nodeData.inputs?.apiKey as string
const obj: Partial<ZapiterNLAWrapperParams> = {
apiKey
}
const zapier = new ZapierNLAWrapper(obj)
const toolkit = await ZapierToolKit.fromZapierNLAWrapper(zapier)
return toolkit.tools
}
}
module.exports = { nodeClass: ZapierNLA_Tools }
Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B