324 lines
13 KiB
JSON
324 lines
13 KiB
JSON
{
|
|
"description": "Output antonym of given user input using few-shot prompt template built with examples",
|
|
"nodes": [
|
|
{
|
|
"width": 300,
|
|
"height": 360,
|
|
"id": "promptTemplate_0",
|
|
"position": {
|
|
"x": 294.38456937448433,
|
|
"y": 66.5400435451831
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "promptTemplate_0",
|
|
"label": "Prompt Template",
|
|
"name": "promptTemplate",
|
|
"type": "PromptTemplate",
|
|
"baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"],
|
|
"category": "Prompts",
|
|
"description": "Schema to represent a basic prompt for an LLM",
|
|
"inputParams": [
|
|
{
|
|
"label": "Template",
|
|
"name": "template",
|
|
"type": "string",
|
|
"rows": 5,
|
|
"placeholder": "What is a good name for a company that makes {product}?"
|
|
}
|
|
],
|
|
"inputAnchors": [],
|
|
"inputs": {
|
|
"template": "Word: {word}\\nAntonym: {antonym}\\n"
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
|
"name": "promptTemplate",
|
|
"label": "PromptTemplate",
|
|
"type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate"
|
|
}
|
|
],
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": 294.38456937448433,
|
|
"y": 66.5400435451831
|
|
},
|
|
"dragging": false
|
|
},
|
|
{
|
|
"width": 300,
|
|
"height": 886,
|
|
"id": "fewShotPromptTemplate_0",
|
|
"position": {
|
|
"x": 719.2200337843097,
|
|
"y": 67.20405755860693
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "fewShotPromptTemplate_0",
|
|
"label": "Few Shot Prompt Template",
|
|
"name": "fewShotPromptTemplate",
|
|
"type": "FewShotPromptTemplate",
|
|
"baseClasses": ["FewShotPromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"],
|
|
"category": "Prompts",
|
|
"description": "Prompt template you can build with examples",
|
|
"inputParams": [
|
|
{
|
|
"label": "Examples",
|
|
"name": "examples",
|
|
"type": "string",
|
|
"rows": 5,
|
|
"placeholder": "[\n { \"word\": \"happy\", \"antonym\": \"sad\" },\n { \"word\": \"tall\", \"antonym\": \"short\" },\n]"
|
|
},
|
|
{
|
|
"label": "Prefix",
|
|
"name": "prefix",
|
|
"type": "string",
|
|
"rows": 3,
|
|
"placeholder": "Give the antonym of every input"
|
|
},
|
|
{
|
|
"label": "Suffix",
|
|
"name": "suffix",
|
|
"type": "string",
|
|
"rows": 3,
|
|
"placeholder": "Word: {input}\nAntonym:"
|
|
},
|
|
{
|
|
"label": "Example Seperator",
|
|
"name": "exampleSeparator",
|
|
"type": "string",
|
|
"placeholder": "\n\n"
|
|
},
|
|
{
|
|
"label": "Template Format",
|
|
"name": "templateFormat",
|
|
"type": "options",
|
|
"options": [
|
|
{
|
|
"label": "f-string",
|
|
"name": "f-string"
|
|
},
|
|
{
|
|
"label": "jinja-2",
|
|
"name": "jinja-2"
|
|
}
|
|
],
|
|
"default": "f-string"
|
|
}
|
|
],
|
|
"inputAnchors": [
|
|
{
|
|
"label": "Example Prompt",
|
|
"name": "examplePrompt",
|
|
"type": "PromptTemplate",
|
|
"id": "fewShotPromptTemplate_0-input-examplePrompt-PromptTemplate"
|
|
}
|
|
],
|
|
"inputs": {
|
|
"examples": "[\n { \"word\": \"happy\", \"antonym\": \"sad\" },\n { \"word\": \"tall\", \"antonym\": \"short\" }\n]",
|
|
"examplePrompt": "{{promptTemplate_0.data.instance}}",
|
|
"prefix": "Give the antonym of every input",
|
|
"suffix": "Word: {input}\\nAntonym:",
|
|
"exampleSeparator": "\\n\\n",
|
|
"templateFormat": "f-string"
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "fewShotPromptTemplate_0-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
|
"name": "fewShotPromptTemplate",
|
|
"label": "FewShotPromptTemplate",
|
|
"type": "FewShotPromptTemplate | BaseStringPromptTemplate | BasePromptTemplate"
|
|
}
|
|
],
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": 719.2200337843097,
|
|
"y": 67.20405755860693
|
|
},
|
|
"dragging": false
|
|
},
|
|
{
|
|
"width": 300,
|
|
"height": 472,
|
|
"id": "openAI_0",
|
|
"position": {
|
|
"x": 1089.6434062122398,
|
|
"y": 27.515288538129425
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "openAI_0",
|
|
"label": "OpenAI",
|
|
"name": "openAI",
|
|
"type": "OpenAI",
|
|
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
|
|
"category": "LLMs",
|
|
"description": "Wrapper around OpenAI large language models",
|
|
"inputParams": [
|
|
{
|
|
"label": "OpenAI Api Key",
|
|
"name": "openAIApiKey",
|
|
"type": "password"
|
|
},
|
|
{
|
|
"label": "Model Name",
|
|
"name": "modelName",
|
|
"type": "options",
|
|
"options": [
|
|
{
|
|
"label": "text-davinci-003",
|
|
"name": "text-davinci-003"
|
|
},
|
|
{
|
|
"label": "text-davinci-002",
|
|
"name": "text-davinci-002"
|
|
},
|
|
{
|
|
"label": "text-curie-001",
|
|
"name": "text-curie-001"
|
|
},
|
|
{
|
|
"label": "text-babbage-001",
|
|
"name": "text-babbage-001"
|
|
}
|
|
],
|
|
"default": "text-davinci-003",
|
|
"optional": true
|
|
},
|
|
{
|
|
"label": "Temperature",
|
|
"name": "temperature",
|
|
"type": "number",
|
|
"default": 0.7,
|
|
"optional": true
|
|
}
|
|
],
|
|
"inputAnchors": [],
|
|
"inputs": {
|
|
"modelName": "text-davinci-003",
|
|
"temperature": 0.7
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel",
|
|
"name": "openAI",
|
|
"label": "OpenAI",
|
|
"type": "OpenAI | BaseLLM | BaseLanguageModel"
|
|
}
|
|
],
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": 1089.6434062122398,
|
|
"y": 27.515288538129425
|
|
},
|
|
"dragging": false
|
|
},
|
|
{
|
|
"width": 300,
|
|
"height": 461,
|
|
"id": "llmChain_0",
|
|
"position": {
|
|
"x": 1499.2654451385026,
|
|
"y": 356.3275374721362
|
|
},
|
|
"type": "customNode",
|
|
"data": {
|
|
"id": "llmChain_0",
|
|
"label": "LLM Chain",
|
|
"name": "llmChain",
|
|
"type": "LLMChain",
|
|
"baseClasses": ["LLMChain", "BaseChain"],
|
|
"category": "Chains",
|
|
"description": "Chain to run queries against LLMs",
|
|
"inputParams": [
|
|
{
|
|
"label": "Format Prompt Values",
|
|
"name": "promptValues",
|
|
"type": "string",
|
|
"rows": 5,
|
|
"placeholder": "{\n \"input_language\": \"English\",\n \"output_language\": \"French\"\n}",
|
|
"optional": true
|
|
}
|
|
],
|
|
"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"
|
|
}
|
|
],
|
|
"inputs": {
|
|
"model": "{{openAI_0.data.instance}}",
|
|
"prompt": "{{fewShotPromptTemplate_0.data.instance}}",
|
|
"promptValues": ""
|
|
},
|
|
"outputAnchors": [
|
|
{
|
|
"id": "llmChain_0-output-llmChain-LLMChain|BaseChain",
|
|
"name": "llmChain",
|
|
"label": "LLMChain",
|
|
"type": "LLMChain | BaseChain"
|
|
}
|
|
],
|
|
"selected": false
|
|
},
|
|
"selected": false,
|
|
"positionAbsolute": {
|
|
"x": 1499.2654451385026,
|
|
"y": 356.3275374721362
|
|
},
|
|
"dragging": false
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"source": "promptTemplate_0",
|
|
"sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
|
"target": "fewShotPromptTemplate_0",
|
|
"targetHandle": "fewShotPromptTemplate_0-input-examplePrompt-PromptTemplate",
|
|
"type": "buttonedge",
|
|
"id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-fewShotPromptTemplate_0-fewShotPromptTemplate_0-input-examplePrompt-PromptTemplate",
|
|
"data": {
|
|
"label": ""
|
|
}
|
|
},
|
|
{
|
|
"source": "openAI_0",
|
|
"sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel",
|
|
"target": "llmChain_0",
|
|
"targetHandle": "llmChain_0-input-model-BaseLanguageModel",
|
|
"type": "buttonedge",
|
|
"id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_0-llmChain_0-input-model-BaseLanguageModel",
|
|
"data": {
|
|
"label": ""
|
|
}
|
|
},
|
|
{
|
|
"source": "fewShotPromptTemplate_0",
|
|
"sourceHandle": "fewShotPromptTemplate_0-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate",
|
|
"target": "llmChain_0",
|
|
"targetHandle": "llmChain_0-input-prompt-BasePromptTemplate",
|
|
"type": "buttonedge",
|
|
"id": "fewShotPromptTemplate_0-fewShotPromptTemplate_0-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate",
|
|
"data": {
|
|
"label": ""
|
|
}
|
|
}
|
|
]
|
|
}
|