mirror of https://github.com/FlowiseAI/Flowise.git
425 lines
17 KiB
JSON
425 lines
17 KiB
JSON
{
|
|
"description": "Language translation using LLM Chain with a Chat Prompt Template and Chat Model",
|
|
"usecases": ["Basic"],
|
|
"framework": ["Langchain"],
|
|
"nodes": [
|
|
{
|
|
"width": 300,
|
|
"height": 690,
|
|
"id": "chatPromptTemplate_0",
|
|
"position": {
|
|
"x": 88.10922294721732,
|
|
"y": 373.4354021348812
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "chatPromptTemplate_0",
|
|
"label": "Chat Prompt Template",
|
|
"version": 1,
|
|
"name": "chatPromptTemplate",
|
|
"type": "ChatPromptTemplate",
|
|
"baseClasses": ["ChatPromptTemplate", "BaseChatPromptTemplate", "BasePromptTemplate"],
|
|
"category": "Prompts",
|
|
"description": "Schema to represent a chat prompt",
|
|
"inputParams": [
|
|
{
|
|
"label": "System Message",
|
|
"name": "systemMessagePrompt",
|
|
"type": "string",
|
|
"rows": 4,
|
|
"placeholder": "You are a helpful assistant that translates {input_language} to {output_language}.",
|
|
"id": "chatPromptTemplate_0-input-systemMessagePrompt-string"
|
|
},
|
|
{
|
|
"label": "Human Message",
|
|
"name": "humanMessagePrompt",
|
|
"type": "string",
|
|
"rows": 4,
|
|
"placeholder": "{text}",
|
|
"id": "chatPromptTemplate_0-input-humanMessagePrompt-string"
|
|
},
|
|
{
|
|
"label": "Format Prompt Values",
|
|
"name": "promptValues",
|
|
"type": "json",
|
|
"optional": true,
|
|
"acceptVariable": true,
|
|
"list": true,
|
|
"id": "chatPromptTemplate_0-input-promptValues-json"
|
|
}
|
|
],
|
|
"inputAnchors": [],
|
|
"inputs": {
|
|
"systemMessagePrompt": "You are a helpful assistant that translates {input_language} to {output_language}.",
|
|
"humanMessagePrompt": "{text}",
|
|
"promptValues": "{\"input_language\":\"English\",\"output_language\":\"French\",\"text\":\"\"}"
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate",
|
|
"name": "chatPromptTemplate",
|
|
"label": "ChatPromptTemplate",
|
|
"type": "ChatPromptTemplate | BaseChatPromptTemplate | BasePromptTemplate"
|
|
}
|
|
],
|
|
"outputs": {},
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": 88.10922294721732,
|
|
"y": 373.4354021348812
|
|
},
|
|
"dragging": false
|
|
},
|
|
{
|
|
"width": 300,
|
|
"height": 670,
|
|
"id": "chatOpenAI_0",
|
|
"position": {
|
|
"x": 423.0077090865524,
|
|
"y": 380.66673510213775
|
|
},
|
|
"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-3.5-turbo",
|
|
"temperature": "0",
|
|
"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": 423.0077090865524,
|
|
"y": 380.66673510213775
|
|
},
|
|
"dragging": false
|
|
},
|
|
{
|
|
"width": 300,
|
|
"height": 508,
|
|
"id": "llmChain_0",
|
|
"position": {
|
|
"x": 774.5069894501554,
|
|
"y": 480.02655553818863
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "llmChain_0",
|
|
"label": "LLM Chain",
|
|
"version": 3,
|
|
"name": "llmChain",
|
|
"type": "LLMChain",
|
|
"baseClasses": ["LLMChain", "BaseChain", "Runnable"],
|
|
"category": "Chains",
|
|
"description": "Chain to run queries against LLMs",
|
|
"inputParams": [
|
|
{
|
|
"label": "Chain Name",
|
|
"name": "chainName",
|
|
"type": "string",
|
|
"placeholder": "Name Your Chain",
|
|
"optional": true,
|
|
"id": "llmChain_0-input-chainName-string"
|
|
}
|
|
],
|
|
"inputAnchors": [
|
|
{
|
|
"label": "Language Model",
|
|
"name": "model",
|
|
"type": "BaseLanguageModel",
|
|
"id": "llmChain_0-input-model-BaseLanguageModel"
|
|
},
|
|
{
|
|
"label": "Prompt",
|
|
"name": "prompt",
|
|
"type": "BasePromptTemplate",
|
|
"id": "llmChain_0-input-prompt-BasePromptTemplate"
|
|
},
|
|
{
|
|
"label": "Output Parser",
|
|
"name": "outputParser",
|
|
"type": "BaseLLMOutputParser",
|
|
"optional": true,
|
|
"id": "llmChain_0-input-outputParser-BaseLLMOutputParser"
|
|
},
|
|
{
|
|
"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": "llmChain_0-input-inputModeration-Moderation"
|
|
}
|
|
],
|
|
"inputs": {
|
|
"model": "{{chatOpenAI_0.data.instance}}",
|
|
"prompt": "{{chatPromptTemplate_0.data.instance}}",
|
|
"outputParser": "",
|
|
"chainName": "Language Translation",
|
|
"inputModeration": ""
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"name": "output",
|
|
"label": "Output",
|
|
"type": "options",
|
|
"options": [
|
|
{
|
|
"id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable",
|
|
"name": "llmChain",
|
|
"label": "LLM Chain",
|
|
"type": "LLMChain | BaseChain | Runnable"
|
|
},
|
|
{
|
|
"id": "llmChain_0-output-outputPrediction-string|json",
|
|
"name": "outputPrediction",
|
|
"label": "Output Prediction",
|
|
"type": "string | json"
|
|
}
|
|
],
|
|
"default": "llmChain"
|
|
}
|
|
],
|
|
"outputs": {
|
|
"output": "llmChain"
|
|
},
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"dragging": false,
|
|
"positionAbsolute": {
|
|
"x": 774.5069894501554,
|
|
"y": 480.02655553818863
|
|
}
|
|
},
|
|
{
|
|
"id": "stickyNote_0",
|
|
"position": {
|
|
"x": -258.15932684125505,
|
|
"y": 656.5109602097457
|
|
},
|
|
"type": "stickyNote",
|
|
"data": {
|
|
"id": "stickyNote_0",
|
|
"label": "Sticky Note",
|
|
"version": 2,
|
|
"name": "stickyNote",
|
|
"type": "StickyNote",
|
|
"baseClasses": ["StickyNote"],
|
|
"tags": ["Utilities"],
|
|
"category": "Utilities",
|
|
"description": "Add a sticky note",
|
|
"inputParams": [
|
|
{
|
|
"label": "",
|
|
"name": "note",
|
|
"type": "string",
|
|
"rows": 1,
|
|
"placeholder": "Type something here",
|
|
"optional": true,
|
|
"id": "stickyNote_0-input-note-string"
|
|
}
|
|
],
|
|
"inputAnchors": [],
|
|
"inputs": {
|
|
"note": "In the Format Prompt Values, we can specify the variables used in prompt.\n\n{\n input_language: \"English\",\n output_language: \"French\"\n}\n\nIf the last variable is not specified, in this case {text}, user question will be used as value."
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "stickyNote_0-output-stickyNote-StickyNote",
|
|
"name": "stickyNote",
|
|
"label": "StickyNote",
|
|
"description": "Add a sticky note",
|
|
"type": "StickyNote"
|
|
}
|
|
],
|
|
"outputs": {},
|
|
"selected": false
|
|
},
|
|
"width": 300,
|
|
"height": 243,
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": -258.15932684125505,
|
|
"y": 656.5109602097457
|
|
},
|
|
"dragging": false
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"source": "chatOpenAI_0",
|
|
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
|
"target": "llmChain_0",
|
|
"targetHandle": "llmChain_0-input-model-BaseLanguageModel",
|
|
"type": "buttonedge",
|
|
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-llmChain_0-llmChain_0-input-model-BaseLanguageModel",
|
|
"data": {
|
|
"label": ""
|
|
}
|
|
},
|
|
{
|
|
"source": "chatPromptTemplate_0",
|
|
"sourceHandle": "chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate",
|
|
"target": "llmChain_0",
|
|
"targetHandle": "llmChain_0-input-prompt-BasePromptTemplate",
|
|
"type": "buttonedge",
|
|
"id": "chatPromptTemplate_0-chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate",
|
|
"data": {
|
|
"label": ""
|
|
}
|
|
}
|
|
]
|
|
}
|