Skip to content

Instantly share code, notes, and snippets.

@HenryHengZJ
Created May 14, 2024 13:31
Show Gist options
  • Save HenryHengZJ/698d1b67561c3622f83c93ae4bdd6deb to your computer and use it in GitHub Desktop.
Save HenryHengZJ/698d1b67561c3622f83c93ae4bdd6deb to your computer and use it in GitHub Desktop.
GPT-4o Template
{
"nodes": [
{
"width": 300,
"height": 669,
"id": "chatOpenAI_0",
"position": {
"x": 328.9896804422258,
"y": -161.74503618858535
},
"type": "customNode",
"data": {
"id": "chatOpenAI_0",
"label": "ChatOpenAI",
"version": 6,
"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_0-input-credential-credential"
},
{
"label": "Model Name",
"name": "modelName",
"type": "asyncOptions",
"loadMethod": "listModels",
"default": "gpt-3.5-turbo",
"id": "chatOpenAI_0-input-modelName-options"
},
{
"label": "Temperature",
"name": "temperature",
"type": "number",
"default": 0.9,
"optional": true,
"id": "chatOpenAI_0-input-temperature-number"
},
{
"label": "Max Tokens",
"name": "maxTokens",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-maxTokens-number"
},
{
"label": "Top Probability",
"name": "topP",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-topP-number"
},
{
"label": "Frequency Penalty",
"name": "frequencyPenalty",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-frequencyPenalty-number"
},
{
"label": "Presence Penalty",
"name": "presencePenalty",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-presencePenalty-number"
},
{
"label": "Timeout",
"name": "timeout",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-timeout-number"
},
{
"label": "BasePath",
"name": "basepath",
"type": "string",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-input-basepath-string"
},
{
"label": "BaseOptions",
"name": "baseOptions",
"type": "json",
"optional": true,
"additionalParams": true,
"id": "chatOpenAI_0-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_0-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_0-input-imageResolution-options"
}
],
"inputAnchors": [
{
"label": "Cache",
"name": "cache",
"type": "BaseCache",
"optional": true,
"id": "chatOpenAI_0-input-cache-BaseCache"
}
],
"inputs": {
"modelName": "gpt-4o",
"temperature": 0.9,
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": true,
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
}
],
"outputs": {},
"selected": false
},
"selected": false,
"positionAbsolute": {
"x": 328.9896804422258,
"y": -161.74503618858535
},
"dragging": false
},
{
"id": "toolAgent_0",
"position": {
"x": 1871.8237848279157,
"y": 128.3204360408733
},
"type": "customNode",
"data": {
"id": "toolAgent_0",
"label": "Tool Agent",
"version": 1,
"name": "toolAgent",
"type": "AgentExecutor",
"baseClasses": [
"AgentExecutor",
"BaseChain",
"Runnable"
],
"category": "Agents",
"description": "Agent that uses Function Calling to pick the tools and args to call",
"inputParams": [
{
"label": "System Message",
"name": "systemMessage",
"type": "string",
"default": "You are a helpful AI assistant.",
"rows": 4,
"optional": true,
"additionalParams": true,
"id": "toolAgent_0-input-systemMessage-string"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "toolAgent_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"id": "toolAgent_0-input-tools-Tool"
},
{
"label": "Memory",
"name": "memory",
"type": "BaseChatMemory",
"id": "toolAgent_0-input-memory-BaseChatMemory"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling. ChatOpenAI, ChatMistral, ChatAnthropic, ChatVertexAI",
"id": "toolAgent_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": "toolAgent_0-input-inputModeration-Moderation"
}
],
"inputs": {
"tools": [
"{{retrieverTool_0.data.instance}}"
],
"memory": "{{bufferMemory_0.data.instance}}",
"model": "{{chatOpenAI_0.data.instance}}",
"systemMessage": "You are a helpful assistant",
"inputModeration": "",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "toolAgent_0-output-toolAgent-AgentExecutor|BaseChain|Runnable",
"name": "toolAgent",
"label": "AgentExecutor",
"description": "Agent that uses Function Calling to pick the tools and args to call",
"type": "AgentExecutor | BaseChain | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 434,
"selected": false,
"positionAbsolute": {
"x": 1871.8237848279157,
"y": 128.3204360408733
},
"dragging": false
},
{
"id": "bufferMemory_0",
"position": {
"x": 1018.8160989278725,
"y": 92.39911754678917
},
"type": "customNode",
"data": {
"id": "bufferMemory_0",
"label": "Buffer Memory",
"version": 2,
"name": "bufferMemory",
"type": "BufferMemory",
"baseClasses": [
"BufferMemory",
"BaseChatMemory",
"BaseMemory"
],
"category": "Memory",
"description": "Retrieve chat messages stored in database",
"inputParams": [
{
"label": "Session Id",
"name": "sessionId",
"type": "string",
"description": "If not specified, a random id will be used. Learn <a target=\"_blank\" href=\"https://docs.flowiseai.com/memory#ui-and-embedded-chat\">more</a>",
"default": "",
"additionalParams": true,
"optional": true,
"id": "bufferMemory_0-input-sessionId-string"
},
{
"label": "Memory Key",
"name": "memoryKey",
"type": "string",
"default": "chat_history",
"additionalParams": true,
"id": "bufferMemory_0-input-memoryKey-string"
}
],
"inputAnchors": [],
"inputs": {
"sessionId": "",
"memoryKey": "chat_history"
},
"outputAnchors": [
{
"id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
"name": "bufferMemory",
"label": "BufferMemory",
"description": "Retrieve chat messages stored in database",
"type": "BufferMemory | BaseChatMemory | BaseMemory"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 251,
"selected": false,
"positionAbsolute": {
"x": 1018.8160989278725,
"y": 92.39911754678917
},
"dragging": false
},
{
"id": "retrieverTool_0",
"position": {
"x": 1412.1795410151967,
"y": -371.82797561956977
},
"type": "customNode",
"data": {
"id": "retrieverTool_0",
"label": "Retriever Tool",
"version": 2,
"name": "retrieverTool",
"type": "RetrieverTool",
"baseClasses": [
"RetrieverTool",
"DynamicTool",
"Tool",
"StructuredTool",
"Runnable"
],
"category": "Tools",
"description": "Use a retriever as allowed tool for agent",
"inputParams": [
{
"label": "Retriever Name",
"name": "name",
"type": "string",
"placeholder": "search_state_of_union",
"id": "retrieverTool_0-input-name-string"
},
{
"label": "Retriever Description",
"name": "description",
"type": "string",
"description": "When should agent uses to retrieve documents",
"rows": 3,
"placeholder": "Searches and returns documents regarding the state-of-the-union.",
"id": "retrieverTool_0-input-description-string"
},
{
"label": "Return Source Documents",
"name": "returnSourceDocuments",
"type": "boolean",
"optional": true,
"id": "retrieverTool_0-input-returnSourceDocuments-boolean"
}
],
"inputAnchors": [
{
"label": "Retriever",
"name": "retriever",
"type": "BaseRetriever",
"id": "retrieverTool_0-input-retriever-BaseRetriever"
}
],
"inputs": {
"name": "search_issue",
"description": "Searches and return answers or solutions to fix the bugs",
"retriever": "{{faiss_0.data.instance}}",
"returnSourceDocuments": ""
},
"outputAnchors": [
{
"id": "retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable",
"name": "retrieverTool",
"label": "RetrieverTool",
"description": "Use a retriever as allowed tool for agent",
"type": "RetrieverTool | DynamicTool | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 602,
"positionAbsolute": {
"x": 1412.1795410151967,
"y": -371.82797561956977
},
"selected": false,
"dragging": false
},
{
"id": "faiss_0",
"position": {
"x": 1026.2111138365644,
"y": -402.9662560082513
},
"type": "customNode",
"data": {
"id": "faiss_0",
"label": "Faiss",
"version": 1,
"name": "faiss",
"type": "Faiss",
"baseClasses": [
"Faiss",
"VectorStoreRetriever",
"BaseRetriever"
],
"category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Faiss library from Meta",
"inputParams": [
{
"label": "Base Path to load",
"name": "basePath",
"description": "Path to load faiss.index file",
"placeholder": "C:\\Users\\User\\Desktop",
"type": "string",
"id": "faiss_0-input-basePath-string"
},
{
"label": "Top K",
"name": "topK",
"description": "Number of top results to fetch. Default to 4",
"placeholder": "4",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "faiss_0-input-topK-number"
}
],
"inputAnchors": [
{
"label": "Document",
"name": "document",
"type": "Document",
"list": true,
"optional": true,
"id": "faiss_0-input-document-Document"
},
{
"label": "Embeddings",
"name": "embeddings",
"type": "Embeddings",
"id": "faiss_0-input-embeddings-Embeddings"
}
],
"inputs": {
"document": "",
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
"basePath": "C:\\Users\\Henry\\Desktop\\testdata\\faiss",
"topK": ""
},
"outputAnchors": [
{
"name": "output",
"label": "Output",
"type": "options",
"description": "",
"options": [
{
"id": "faiss_0-output-retriever-Faiss|VectorStoreRetriever|BaseRetriever",
"name": "retriever",
"label": "Faiss Retriever",
"description": "",
"type": "Faiss | VectorStoreRetriever | BaseRetriever"
},
{
"id": "faiss_0-output-vectorStore-Faiss|SaveableVectorStore|VectorStore",
"name": "vectorStore",
"label": "Faiss Vector Store",
"description": "",
"type": "Faiss | SaveableVectorStore | VectorStore"
}
],
"default": "retriever"
}
],
"outputs": {
"output": "retriever"
},
"selected": false
},
"width": 300,
"height": 458,
"selected": false,
"positionAbsolute": {
"x": 1026.2111138365644,
"y": -402.9662560082513
},
"dragging": false
},
{
"id": "openAIEmbeddings_0",
"position": {
"x": 658.7794052501235,
"y": -395.18168591108093
},
"type": "customNode",
"data": {
"id": "openAIEmbeddings_0",
"label": "OpenAI Embeddings",
"version": 4,
"name": "openAIEmbeddings",
"type": "OpenAIEmbeddings",
"baseClasses": [
"OpenAIEmbeddings",
"Embeddings"
],
"category": "Embeddings",
"description": "OpenAI API to generate embeddings for a given text",
"inputParams": [
{
"label": "Connect Credential",
"name": "credential",
"type": "credential",
"credentialNames": [
"openAIApi"
],
"id": "openAIEmbeddings_0-input-credential-credential"
},
{
"label": "Model Name",
"name": "modelName",
"type": "asyncOptions",
"loadMethod": "listModels",
"default": "text-embedding-ada-002",
"id": "openAIEmbeddings_0-input-modelName-asyncOptions"
},
{
"label": "Strip New Lines",
"name": "stripNewLines",
"type": "boolean",
"optional": true,
"additionalParams": true,
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
},
{
"label": "Batch Size",
"name": "batchSize",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "openAIEmbeddings_0-input-batchSize-number"
},
{
"label": "Timeout",
"name": "timeout",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "openAIEmbeddings_0-input-timeout-number"
},
{
"label": "BasePath",
"name": "basepath",
"type": "string",
"optional": true,
"additionalParams": true,
"id": "openAIEmbeddings_0-input-basepath-string"
},
{
"label": "Dimensions",
"name": "dimensions",
"type": "number",
"optional": true,
"additionalParams": true,
"id": "openAIEmbeddings_0-input-dimensions-number"
}
],
"inputAnchors": [],
"inputs": {
"modelName": "text-embedding-ada-002",
"stripNewLines": "",
"batchSize": "",
"timeout": "",
"basepath": "",
"dimensions": ""
},
"outputAnchors": [
{
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
"name": "openAIEmbeddings",
"label": "OpenAIEmbeddings",
"description": "OpenAI API to generate embeddings for a given text",
"type": "OpenAIEmbeddings | Embeddings"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 423,
"selected": false,
"positionAbsolute": {
"x": 658.7794052501235,
"y": -395.18168591108093
},
"dragging": false
}
],
"edges": [
{
"source": "bufferMemory_0",
"sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
"target": "toolAgent_0",
"targetHandle": "toolAgent_0-input-memory-BaseChatMemory",
"type": "buttonedge",
"id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-toolAgent_0-toolAgent_0-input-memory-BaseChatMemory"
},
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
"target": "toolAgent_0",
"targetHandle": "toolAgent_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-toolAgent_0-toolAgent_0-input-model-BaseChatModel"
},
{
"source": "faiss_0",
"sourceHandle": "faiss_0-output-retriever-Faiss|VectorStoreRetriever|BaseRetriever",
"target": "retrieverTool_0",
"targetHandle": "retrieverTool_0-input-retriever-BaseRetriever",
"type": "buttonedge",
"id": "faiss_0-faiss_0-output-retriever-Faiss|VectorStoreRetriever|BaseRetriever-retrieverTool_0-retrieverTool_0-input-retriever-BaseRetriever"
},
{
"source": "openAIEmbeddings_0",
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
"target": "faiss_0",
"targetHandle": "faiss_0-input-embeddings-Embeddings",
"type": "buttonedge",
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-faiss_0-faiss_0-input-embeddings-Embeddings"
},
{
"source": "retrieverTool_0",
"sourceHandle": "retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable",
"target": "toolAgent_0",
"targetHandle": "toolAgent_0-input-tools-Tool",
"type": "buttonedge",
"id": "retrieverTool_0-retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable-toolAgent_0-toolAgent_0-input-tools-Tool"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment