Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { initializeAgentExecutorWithOptions, AgentExecutor } from 'langchain/agents'
import { Tool } from 'langchain/tools'
import { CustomChainHandler, getBaseClasses } from '../../../src/utils'
import { BaseLanguageModel } from 'langchain/base_language'
import { flatten } from 'lodash'

class OpenAIFunctionAgent_Agents implements INode {
label: string
name: string
description: string
type: string
icon: string
category: string
baseClasses: string[]
inputs: INodeParams[]

constructor() {
this.label = 'OpenAI Function Agent'
this.name = 'openAIFunctionAgent'
this.type = 'AgentExecutor'
this.category = 'Agents'
this.icon = 'openai.png'
this.description = `An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call`
this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)]
this.inputs = [
{
label: 'Allowed Tools',
name: 'tools',
type: 'Tool',
list: true
},
{
label: 'OpenAI Chat Model',
name: 'model',
description:
'Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer <a target="_blank" href="https://platform.openai.com/docs/guides/gpt/function-calling">docs</a> for more info',
type: 'BaseChatModel'
}
]
}

async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseLanguageModel
let tools = nodeData.inputs?.tools as Tool[]
tools = flatten(tools)

const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'openai-functions',
verbose: process.env.DEBUG === 'true' ? true : false
})
return executor
}

async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
const executor = nodeData.instance as AgentExecutor

if (options.socketIO && options.socketIOClientId) {
const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId)
const result = await executor.run(input, [handler])
return result
} else {
const result = await executor.run(input)
return result
}
}
}

module.exports = { nodeClass: OpenAIFunctionAgent_Agents }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@ class ChatOpenAI_ChatModels implements INode {
label: 'gpt-4-32k-0314',
name: 'gpt-4-32k-0314'
},
{
label: 'gpt-4-0613',
name: 'gpt-4-0613'
},
{
label: 'gpt-3.5-turbo',
name: 'gpt-3.5-turbo'
},
{
label: 'gpt-3.5-turbo-0301',
name: 'gpt-3.5-turbo-0301'
},
{
label: 'gpt-3.5-turbo-0613',
name: 'gpt-3.5-turbo-0613'
}
],
default: 'gpt-3.5-turbo',
Expand Down
4 changes: 2 additions & 2 deletions packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools'
import { ZapierNLAWrapper, ZapierNLAWrapperParams } from 'langchain/tools'
import { INode, INodeData, INodeParams } from '../../../src/Interface'
import { ZapierToolKit } from 'langchain/agents'

Expand Down Expand Up @@ -32,7 +32,7 @@ class ZapierNLA_Tools implements INode {
async init(nodeData: INodeData): Promise<any> {
const apiKey = nodeData.inputs?.apiKey as string

const obj: Partial<ZapiterNLAWrapperParams> = {
const obj: Partial<ZapierNLAWrapperParams> = {
apiKey
}
const zapier = new ZapierNLAWrapper(obj)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"faiss-node": "^0.2.1",
"form-data": "^4.0.0",
"graphql": "^16.6.0",
"langchain": "^0.0.91",
"langchain": "^0.0.94",
"linkifyjs": "^4.1.1",
"mammoth": "^1.5.1",
"moment": "^2.29.3",
Expand Down
24 changes: 24 additions & 0 deletions packages/server/marketplaces/API Agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down Expand Up @@ -481,13 +489,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down Expand Up @@ -620,13 +636,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/AutoGPT.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/BabyAGI.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/ChatGPTPlugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/Conversational Agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/Github Repo QnA.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/Multi Prompt Chain.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
8 changes: 8 additions & 0 deletions packages/server/marketplaces/Multi Retrieval QA Chain.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,21 @@
"label": "gpt-4-32k-0314",
"name": "gpt-4-32k-0314"
},
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
{
"label": "gpt-3.5-turbo-0301",
"name": "gpt-3.5-turbo-0301"
},
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
}
],
"default": "gpt-3.5-turbo",
Expand Down
Loading