{ "description": "Use OpenAI Tool Agent and Chain to automatically decide which API to call, generating url and body request from conversation", "categories": "Buffer Memory,ChainTool,API Chain,ChatOpenAI,OpenAI Tool Agent,Langchain", "framework": "Langchain", "nodes": [ { "width": 300, "height": 540, "id": "openApiChain_1", "position": { "x": 1203.1825726424859, "y": 300.7226683414998 }, "type": "customNode", "data": { "id": "openApiChain_1", "label": "OpenAPI Chain", "version": 2, "name": "openApiChain", "type": "OpenAPIChain", "baseClasses": ["OpenAPIChain", "BaseChain"], "category": "Chains", "description": "Chain that automatically select and call APIs based only on an OpenAPI spec", "inputParams": [ { "label": "YAML Link", "name": "yamlLink", "type": "string", "placeholder": "https://api.speak.com/openapi.yaml", "description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead", "id": "openApiChain_1-input-yamlLink-string" }, { "label": "YAML File", "name": "yamlFile", "type": "file", "fileType": ".yaml", "description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead", "id": "openApiChain_1-input-yamlFile-file" }, { "label": "Headers", "name": "headers", "type": "json", "additionalParams": true, "optional": true, "id": "openApiChain_1-input-headers-json" } ], "inputAnchors": [ { "label": "ChatOpenAI Model", "name": "model", "type": "ChatOpenAI", "id": "openApiChain_1-input-model-ChatOpenAI" }, { "label": "Input Moderation", "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", "name": "inputModeration", "type": "Moderation", "optional": true, "list": true, "id": "openApiChain_1-input-inputModeration-Moderation" } ], "inputs": { "inputModeration": "", "model": "{{chatOpenAI_1.data.instance}}", "yamlLink": "https://gist.githubusercontent.com/roaldnefs/053e505b2b7a807290908fe9aa3e1f00/raw/0a212622ebfef501163f91e23803552411ed00e4/openapi.yaml", "headers": "" }, "outputAnchors": [ { "id": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain", "name": "openApiChain", "label": "OpenAPIChain", "type": "OpenAPIChain | BaseChain" } ], "outputs": {}, "selected": false }, "selected": false, "positionAbsolute": { "x": 1203.1825726424859, "y": 300.7226683414998 }, "dragging": false }, { "width": 300, "height": 670, "id": "chatOpenAI_1", "position": { "x": 792.3201947594027, "y": 293.61889966751846 }, "type": "customNode", "data": { "id": "chatOpenAI_1", "label": "ChatOpenAI", "version": 5, "name": "chatOpenAI", "type": "ChatOpenAI", "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { "label": "Connect Credential", "name": "credential", "type": "credential", "credentialNames": ["openAIApi"], "id": "chatOpenAI_1-input-credential-credential" }, { "label": "Model Name", "name": "modelName", "type": "options", "options": [ { "label": "gpt-4", "name": "gpt-4" }, { "label": "gpt-4-turbo-preview", "name": "gpt-4-turbo-preview" }, { "label": "gpt-4-0125-preview", "name": "gpt-4-0125-preview" }, { "label": "gpt-4-1106-preview", "name": "gpt-4-1106-preview" }, { "label": "gpt-4-1106-vision-preview", "name": "gpt-4-1106-vision-preview" }, { "label": "gpt-4-vision-preview", "name": "gpt-4-vision-preview" }, { "label": "gpt-4-0613", "name": "gpt-4-0613" }, { "label": "gpt-4-32k", "name": "gpt-4-32k" }, { "label": "gpt-4-32k-0613", "name": "gpt-4-32k-0613" }, { "label": "gpt-3.5-turbo", "name": "gpt-3.5-turbo" }, { "label": "gpt-3.5-turbo-0125", "name": "gpt-3.5-turbo-0125" }, { "label": "gpt-3.5-turbo-1106", "name": "gpt-3.5-turbo-1106" }, { "label": "gpt-3.5-turbo-0613", "name": "gpt-3.5-turbo-0613" }, { "label": "gpt-3.5-turbo-16k", "name": "gpt-3.5-turbo-16k" }, { "label": "gpt-3.5-turbo-16k-0613", "name": "gpt-3.5-turbo-16k-0613" } ], "default": "gpt-3.5-turbo", "optional": true, "id": "chatOpenAI_1-input-modelName-options" }, { "label": "Temperature", "name": "temperature", "type": "number", "default": 0.9, "optional": true, "id": "chatOpenAI_1-input-temperature-number" }, { "label": "Max Tokens", "name": "maxTokens", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-maxTokens-number" }, { "label": "Top Probability", "name": "topP", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-topP-number" }, { "label": "Frequency Penalty", "name": "frequencyPenalty", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-frequencyPenalty-number" }, { "label": "Presence Penalty", "name": "presencePenalty", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-presencePenalty-number" }, { "label": "Timeout", "name": "timeout", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-timeout-number" }, { "label": "BasePath", "name": "basepath", "type": "string", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-basepath-string" }, { "label": "BaseOptions", "name": "baseOptions", "type": "json", "optional": true, "additionalParams": true, "id": "chatOpenAI_1-input-baseOptions-json" }, { "label": "Allow Image Uploads", "name": "allowImageUploads", "type": "boolean", "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent", "default": false, "optional": true, "id": "chatOpenAI_1-input-allowImageUploads-boolean" }, { "label": "Image Resolution", "description": "This parameter controls the resolution in which the model views the image.", "name": "imageResolution", "type": "options", "options": [ { "label": "Low", "name": "low" }, { "label": "High", "name": "high" }, { "label": "Auto", "name": "auto" } ], "default": "low", "optional": false, "additionalParams": true, "id": "chatOpenAI_1-input-imageResolution-options" } ], "inputAnchors": [ { "label": "Cache", "name": "cache", "type": "BaseCache", "optional": true, "id": "chatOpenAI_1-input-cache-BaseCache" } ], "inputs": { "modelName": "gpt-3.5-turbo", "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", "timeout": "", "basepath": "", "baseOptions": "", "allowImageUploads": true, "imageResolution": "low" }, "outputAnchors": [ { "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, "selected": false }, "selected": false, "positionAbsolute": { "x": 792.3201947594027, "y": 293.61889966751846 }, "dragging": false }, { "width": 300, "height": 601, "id": "chainTool_0", "position": { "x": 1635.3466862861876, "y": 272.3189405402944 }, "type": "customNode", "data": { "id": "chainTool_0", "label": "Chain Tool", "version": 1, "name": "chainTool", "type": "ChainTool", "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool"], "category": "Tools", "description": "Use a chain as allowed tool for agent", "inputParams": [ { "label": "Chain Name", "name": "name", "type": "string", "placeholder": "state-of-union-qa", "id": "chainTool_0-input-name-string" }, { "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.", "id": "chainTool_0-input-description-string" }, { "label": "Return Direct", "name": "returnDirect", "type": "boolean", "optional": true, "id": "chainTool_0-input-returnDirect-boolean" } ], "inputAnchors": [ { "label": "Base Chain", "name": "baseChain", "type": "BaseChain", "id": "chainTool_0-input-baseChain-BaseChain" } ], "inputs": { "name": "comic-qa", "description": "useful for when you need to ask question about comic", "returnDirect": false, "baseChain": "{{openApiChain_1.data.instance}}" }, "outputAnchors": [ { "id": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool", "name": "chainTool", "label": "ChainTool", "type": "ChainTool | DynamicTool | Tool | StructuredTool" } ], "outputs": {}, "selected": false }, "selected": false, "positionAbsolute": { "x": 1635.3466862861876, "y": 272.3189405402944 }, "dragging": false }, { "width": 300, "height": 670, "id": "chatOpenAI_2", "position": { "x": 1645.450699499575, "y": 992.6341744217375 }, "type": "customNode", "data": { "id": "chatOpenAI_2", "label": "ChatOpenAI", "version": 5, "name": "chatOpenAI", "type": "ChatOpenAI", "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { "label": "Connect Credential", "name": "credential", "type": "credential", "credentialNames": ["openAIApi"], "id": "chatOpenAI_2-input-credential-credential" }, { "label": "Model Name", "name": "modelName", "type": "options", "options": [ { "label": "gpt-4", "name": "gpt-4" }, { "label": "gpt-4-turbo-preview", "name": "gpt-4-turbo-preview" }, { "label": "gpt-4-0125-preview", "name": "gpt-4-0125-preview" }, { "label": "gpt-4-1106-preview", "name": "gpt-4-1106-preview" }, { "label": "gpt-4-1106-vision-preview", "name": "gpt-4-1106-vision-preview" }, { "label": "gpt-4-vision-preview", "name": "gpt-4-vision-preview" }, { "label": "gpt-4-0613", "name": "gpt-4-0613" }, { "label": "gpt-4-32k", "name": "gpt-4-32k" }, { "label": "gpt-4-32k-0613", "name": "gpt-4-32k-0613" }, { "label": "gpt-3.5-turbo", "name": "gpt-3.5-turbo" }, { "label": "gpt-3.5-turbo-0125", "name": "gpt-3.5-turbo-0125" }, { "label": "gpt-3.5-turbo-1106", "name": "gpt-3.5-turbo-1106" }, { "label": "gpt-3.5-turbo-0613", "name": "gpt-3.5-turbo-0613" }, { "label": "gpt-3.5-turbo-16k", "name": "gpt-3.5-turbo-16k" }, { "label": "gpt-3.5-turbo-16k-0613", "name": "gpt-3.5-turbo-16k-0613" } ], "default": "gpt-3.5-turbo", "optional": true, "id": "chatOpenAI_2-input-modelName-options" }, { "label": "Temperature", "name": "temperature", "type": "number", "default": 0.9, "optional": true, "id": "chatOpenAI_2-input-temperature-number" }, { "label": "Max Tokens", "name": "maxTokens", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-maxTokens-number" }, { "label": "Top Probability", "name": "topP", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-topP-number" }, { "label": "Frequency Penalty", "name": "frequencyPenalty", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-frequencyPenalty-number" }, { "label": "Presence Penalty", "name": "presencePenalty", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-presencePenalty-number" }, { "label": "Timeout", "name": "timeout", "type": "number", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-timeout-number" }, { "label": "BasePath", "name": "basepath", "type": "string", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-basepath-string" }, { "label": "BaseOptions", "name": "baseOptions", "type": "json", "optional": true, "additionalParams": true, "id": "chatOpenAI_2-input-baseOptions-json" }, { "label": "Allow Image Uploads", "name": "allowImageUploads", "type": "boolean", "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent", "default": false, "optional": true, "id": "chatOpenAI_2-input-allowImageUploads-boolean" }, { "label": "Image Resolution", "description": "This parameter controls the resolution in which the model views the image.", "name": "imageResolution", "type": "options", "options": [ { "label": "Low", "name": "low" }, { "label": "High", "name": "high" }, { "label": "Auto", "name": "auto" } ], "default": "low", "optional": false, "additionalParams": true, "id": "chatOpenAI_2-input-imageResolution-options" } ], "inputAnchors": [ { "label": "Cache", "name": "cache", "type": "BaseCache", "optional": true, "id": "chatOpenAI_2-input-cache-BaseCache" } ], "inputs": { "modelName": "gpt-3.5-turbo", "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", "timeout": "", "basepath": "", "baseOptions": "", "allowImageUploads": true, "imageResolution": "low" }, "outputAnchors": [ { "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, "selected": false }, "selected": false, "positionAbsolute": { "x": 1645.450699499575, "y": 992.6341744217375 }, "dragging": false }, { "width": 300, "height": 376, "id": "bufferMemory_0", "position": { "x": 1148.8461056155377, "y": 967.8215757228843 }, "type": "customNode", "data": { "id": "bufferMemory_0", "label": "Buffer Memory", "version": 1, "name": "bufferMemory", "type": "BufferMemory", "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], "category": "Memory", "description": "Remembers previous conversational back and forths directly", "inputParams": [ { "label": "Memory Key", "name": "memoryKey", "type": "string", "default": "chat_history", "id": "bufferMemory_0-input-memoryKey-string" }, { "label": "Input Key", "name": "inputKey", "type": "string", "default": "input", "id": "bufferMemory_0-input-inputKey-string" } ], "inputAnchors": [], "inputs": { "memoryKey": "chat_history", "inputKey": "input" }, "outputAnchors": [ { "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", "name": "bufferMemory", "label": "BufferMemory", "type": "BufferMemory | BaseChatMemory | BaseMemory" } ], "outputs": {}, "selected": false }, "positionAbsolute": { "x": 1148.8461056155377, "y": 967.8215757228843 }, "selected": false }, { "id": "openAIToolAgent_0", "position": { "x": 2083.8842813850474, "y": 749.3536850926545 }, "type": "customNode", "data": { "id": "openAIToolAgent_0", "label": "OpenAI Tool Agent", "version": 1, "name": "openAIToolAgent", "type": "AgentExecutor", "baseClasses": ["AgentExecutor", "BaseChain", "Runnable"], "category": "Agents", "description": "Agent that uses OpenAI Function Calling to pick the tools and args to call", "inputParams": [ { "label": "System Message", "name": "systemMessage", "type": "string", "rows": 4, "optional": true, "additionalParams": true, "id": "openAIToolAgent_0-input-systemMessage-string" } ], "inputAnchors": [ { "label": "Tools", "name": "tools", "type": "Tool", "list": true, "id": "openAIToolAgent_0-input-tools-Tool" }, { "label": "Memory", "name": "memory", "type": "BaseChatMemory", "id": "openAIToolAgent_0-input-memory-BaseChatMemory" }, { "label": "OpenAI/Azure Chat Model", "name": "model", "type": "BaseChatModel", "id": "openAIToolAgent_0-input-model-BaseChatModel" }, { "label": "Input Moderation", "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", "name": "inputModeration", "type": "Moderation", "optional": true, "list": true, "id": "openAIToolAgent_0-input-inputModeration-Moderation" } ], "inputs": { "tools": ["{{chainTool_0.data.instance}}"], "memory": "{{bufferMemory_0.data.instance}}", "model": "{{chatOpenAI_2.data.instance}}", "systemMessage": "", "inputModeration": "" }, "outputAnchors": [ { "id": "openAIToolAgent_0-output-openAIToolAgent-AgentExecutor|BaseChain|Runnable", "name": "openAIToolAgent", "label": "AgentExecutor", "description": "Agent that uses OpenAI Function Calling to pick the tools and args to call", "type": "AgentExecutor | BaseChain | Runnable" } ], "outputs": {}, "selected": false }, "width": 300, "height": 433, "selected": false, "positionAbsolute": { "x": 2083.8842813850474, "y": 749.3536850926545 }, "dragging": false } ], "edges": [ { "source": "chatOpenAI_1", "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "openApiChain_1", "targetHandle": "openApiChain_1-input-model-ChatOpenAI", "type": "buttonedge", "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openApiChain_1-openApiChain_1-input-model-ChatOpenAI", "data": { "label": "" } }, { "source": "openApiChain_1", "sourceHandle": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain", "target": "chainTool_0", "targetHandle": "chainTool_0-input-baseChain-BaseChain", "type": "buttonedge", "id": "openApiChain_1-openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain-chainTool_0-chainTool_0-input-baseChain-BaseChain", "data": { "label": "" } }, { "source": "chainTool_0", "sourceHandle": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool", "target": "openAIToolAgent_0", "targetHandle": "openAIToolAgent_0-input-tools-Tool", "type": "buttonedge", "id": "chainTool_0-chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool-openAIToolAgent_0-openAIToolAgent_0-input-tools-Tool" }, { "source": "bufferMemory_0", "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", "target": "openAIToolAgent_0", "targetHandle": "openAIToolAgent_0-input-memory-BaseChatMemory", "type": "buttonedge", "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIToolAgent_0-openAIToolAgent_0-input-memory-BaseChatMemory" }, { "source": "chatOpenAI_2", "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "openAIToolAgent_0", "targetHandle": "openAIToolAgent_0-input-model-BaseChatModel", "type": "buttonedge", "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openAIToolAgent_0-openAIToolAgent_0-input-model-BaseChatModel" } ] }