Last active
April 17, 2024 13:15
-
-
Save PaulKinlan/0cfa2b05b3b9f4915cc0baf6753094c2 to your computer and use it in GitHub Desktop.
request-body-generator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Request Body Builder", | |
"description": "Builds the POST body for a request", | |
"version": "0.0.1", | |
"nodes": [ | |
{ | |
"type": "output", | |
"id": "output", | |
"configuration": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"json": { | |
"type": "string", | |
"title": "json", | |
"examples": [] | |
} | |
}, | |
"required": [] | |
} | |
}, | |
"metadata": { | |
"visual": { | |
"x": 488, | |
"y": 238 | |
} | |
} | |
}, | |
{ | |
"id": "text-2daa1e8a", | |
"type": "text", | |
"metadata": { | |
"visual": { | |
"x": 214, | |
"y": -774 | |
}, | |
"title": "generate-json", | |
"logLevel": "debug" | |
}, | |
"configuration": { | |
"model": "gemini-1.5-pro-latest", | |
"systemInstruction": "{ \"type\": \"object\", \"additionalProperties\": false, \"properties\": { \"input\": { \"description\": \"Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\\n\", \"example\": \"The quick brown fox jumped over the lazy dog\", \"oneOf\": [ { \"type\": \"string\", \"title\": \"string\", \"description\": \"The string that will be turned into an embedding.\", \"default\": \"\", \"example\": \"This is a test.\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of strings that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"string\", \"default\": \"\", \"example\": \"['This is a test.']\" } }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"integer\" }, \"example\": \"[1212, 318, 257, 1332, 13]\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of arrays containing integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"array\", \"minItems\": 1, \"items\": { \"type\": \"integer\" } }, \"example\": \"[[1212, 318, 257, 1332, 13]]\" } ], \"x-oaiExpandable\": true }, \"model\": { \"description\": \"ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\\n\", \"example\": \"text-embedding-3-small\", \"anyOf\": [ { \"type\": \"string\" }, { \"type\": \"string\", \"enum\": [ \"text-embedding-ada-002\", \"text-embedding-3-small\", \"text-embedding-3-large\" ] } ], \"x-oaiTypeLabel\": \"string\" }, \"encoding_format\": { \"description\": \"The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).\", \"example\": \"float\", \"default\": \"float\", \"type\": \"string\", \"enum\": [\"float\", \"base64\"] }, \"dimensions\": { \"description\": \"The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\\n\", \"type\": \"integer\", \"minimum\": 1 }, \"user\": { \"type\": \"string\", \"example\": \"user-1234\", \"description\": \"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\\n\" } }, \"required\": [\"model\", \"input\"] }" | |
} | |
}, | |
{ | |
"id": "validateJson-eefab6f5", | |
"type": "validateJson", | |
"metadata": { | |
"visual": { | |
"x": -36, | |
"y": 109 | |
}, | |
"title": "validate-json", | |
"logLevel": "debug" | |
}, | |
"configuration": { | |
"schema": { | |
"type": "object", | |
"additionalProperties": false, | |
"properties": { | |
"input": { | |
"description": "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n", | |
"oneOf": [ | |
{ | |
"type": "string", | |
"title": "string", | |
"description": "The string that will be turned into an embedding.", | |
"default": "" | |
}, | |
{ | |
"type": "array", | |
"title": "array", | |
"description": "The array of strings that will be turned into an embedding.", | |
"minItems": 1, | |
"maxItems": 2048, | |
"items": { | |
"type": "string", | |
"default": "" | |
} | |
}, | |
{ | |
"type": "array", | |
"title": "array", | |
"description": "The array of integers that will be turned into an embedding.", | |
"minItems": 1, | |
"maxItems": 2048, | |
"items": { | |
"type": "integer" | |
} | |
}, | |
{ | |
"type": "array", | |
"title": "array", | |
"description": "The array of arrays containing integers that will be turned into an embedding.", | |
"minItems": 1, | |
"maxItems": 2048, | |
"items": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"type": "integer" | |
} | |
} | |
} | |
] | |
}, | |
"model": { | |
"description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", | |
"anyOf": [ | |
{ | |
"type": "string" | |
}, | |
{ | |
"type": "string", | |
"enum": [ | |
"text-embedding-ada-002", | |
"text-embedding-3-small", | |
"text-embedding-3-large" | |
] | |
} | |
] | |
}, | |
"encoding_format": { | |
"description": "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).", | |
"default": "float", | |
"type": "string", | |
"enum": [ | |
"float", | |
"base64" | |
] | |
}, | |
"dimensions": { | |
"description": "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n", | |
"type": "integer", | |
"minimum": 1 | |
}, | |
"user": { | |
"type": "string", | |
"description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" | |
} | |
}, | |
"required": [ | |
"model", | |
"input" | |
] | |
} | |
} | |
}, | |
{ | |
"id": "promptTemplate-47d4a7bf", | |
"type": "promptTemplate", | |
"metadata": { | |
"visual": { | |
"x": -332, | |
"y": -729 | |
}, | |
"title": "create-schema-generation prompt", | |
"logLevel": "debug" | |
}, | |
"configuration": { | |
"template": "Consider the following JSON schema: \n\n```\n{{schema}}\n```\n\nThis JSON Schema represents the format I want you to follow to generate your answer.\n\nBased on all this information, generate a valid JSON object containing the information I requested.\n\nIf you don't have enough information and their isn't a default value, ask for it", | |
"schema": "{ \"type\": \"object\", \"additionalProperties\": false, \"properties\": { \"input\": { \"description\": \"Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\\n\", \"example\": \"The quick brown fox jumped over the lazy dog\", \"oneOf\": [ { \"type\": \"string\", \"title\": \"string\", \"description\": \"The string that will be turned into an embedding.\", \"default\": \"\", \"example\": \"This is a test.\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of strings that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"string\", \"default\": \"\", \"example\": \"['This is a test.']\" } }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"integer\" }, \"example\": \"[1212, 318, 257, 1332, 13]\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of arrays containing integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"array\", \"minItems\": 1, \"items\": { \"type\": \"integer\" } }, \"example\": \"[[1212, 318, 257, 1332, 13]]\" } ], \"x-oaiExpandable\": true }, \"model\": { \"description\": \"ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\\n\", \"example\": \"text-embedding-3-small\", \"anyOf\": [ { \"type\": \"string\" }, { \"type\": \"string\", \"enum\": [ \"text-embedding-ada-002\", \"text-embedding-3-small\", \"text-embedding-3-large\" ] } ], \"x-oaiTypeLabel\": \"string\" }, \"encoding_format\": { \"description\": \"The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).\", \"example\": \"float\", \"default\": \"float\", \"type\": \"string\", \"enum\": [\"float\", \"base64\"] }, \"dimensions\": { \"description\": \"The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\\n\", \"type\": \"integer\", \"minimum\": 1 }, \"user\": { \"type\": \"string\", \"example\": \"user-1234\", \"description\": \"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\\n\" } }, \"required\": [\"model\", \"input\"] }" | |
} | |
}, | |
{ | |
"id": "input-a15bcc81", | |
"type": "input", | |
"metadata": { | |
"visual": { | |
"x": -203, | |
"y": -430 | |
}, | |
"title": "prompt-input", | |
"logLevel": "debug" | |
} | |
}, | |
{ | |
"id": "input-f44b216d", | |
"type": "input", | |
"metadata": { | |
"visual": { | |
"x": -534, | |
"y": -167 | |
} | |
}, | |
"configuration": { | |
"schema": { | |
"properties": { | |
"theSchema": { | |
"type": "string", | |
"title": "The Schema", | |
"examples": [ | |
"{\n \"type\":\"object\",\n \"additionalProperties\":false,\n \"properties\":{\n \"input\":{\n \"description\":\"Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\\n\",\n \"oneOf\":[\n {\n \"type\":\"string\",\n \"title\":\"string\",\n \"description\":\"The string that will be turned into an embedding.\",\n \"default\":\"\"\n },\n {\n \"type\":\"array\",\n \"title\":\"array\",\n \"description\":\"The array of strings that will be turned into an embedding.\",\n \"minItems\":1,\n \"maxItems\":2048,\n \"items\":{\n \"type\":\"string\",\n \"default\":\"\"\n }\n },\n {\n \"type\":\"array\",\n \"title\":\"array\",\n \"description\":\"The array of integers that will be turned into an embedding.\",\n \"minItems\":1,\n \"maxItems\":2048,\n \"items\":{\n \"type\":\"integer\"\n }\n },\n {\n \"type\":\"array\",\n \"title\":\"array\",\n \"description\":\"The array of arrays containing integers that will be turned into an embedding.\",\n \"minItems\":1,\n \"maxItems\":2048,\n \"items\":{\n \"type\":\"array\",\n \"minItems\":1,\n \"items\":{\n \"type\":\"integer\"\n }\n }\n }\n ]\n },\n \"model\":{\n \"description\":\"ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\\n\",\n \"anyOf\":[\n {\n \"type\":\"string\"\n },\n {\n \"type\":\"string\",\n \"enum\":[\n \"text-embedding-ada-002\",\n \"text-embedding-3-small\",\n \"text-embedding-3-large\"\n ]\n }\n ]\n },\n \"encoding_format\":{\n \"description\":\"The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).\",\n \"default\":\"float\",\n \"type\":\"string\",\n \"enum\":[\n \"float\",\n \"base64\"\n ]\n },\n \"dimensions\":{\n \"description\":\"The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\\n\",\n \"type\":\"integer\",\n \"minimum\":1\n },\n \"user\":{\n \"type\":\"string\",\n \"description\":\"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\\n\"\n }\n },\n \"required\":[\n \"model\",\n \"input\"\n ]\n}" | |
], | |
"default": "{ \"type\": \"object\", \"additionalProperties\": false, \"properties\": { \"input\": { \"description\": \"Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\\n\", \"example\": \"The quick brown fox jumped over the lazy dog\", \"oneOf\": [ { \"type\": \"string\", \"title\": \"string\", \"description\": \"The string that will be turned into an embedding.\", \"default\": \"\", \"example\": \"This is a test.\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of strings that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"string\", \"default\": \"\", \"example\": \"['This is a test.']\" } }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"integer\" }, \"example\": \"[1212, 318, 257, 1332, 13]\" }, { \"type\": \"array\", \"title\": \"array\", \"description\": \"The array of arrays containing integers that will be turned into an embedding.\", \"minItems\": 1, \"maxItems\": 2048, \"items\": { \"type\": \"array\", \"minItems\": 1, \"items\": { \"type\": \"integer\" } }, \"example\": \"[[1212, 318, 257, 1332, 13]]\" } ], \"x-oaiExpandable\": true }, \"model\": { \"description\": \"ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\\n\", \"example\": \"text-embedding-3-small\", \"anyOf\": [ { \"type\": \"string\" }, { \"type\": \"string\", \"enum\": [ \"text-embedding-ada-002\", \"text-embedding-3-small\", \"text-embedding-3-large\" ] } ], \"x-oaiTypeLabel\": \"string\" }, \"encoding_format\": { \"description\": \"The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).\", \"example\": \"float\", \"default\": \"float\", \"type\": \"string\", \"enum\": [\"float\", \"base64\"] }, \"dimensions\": { \"description\": \"The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\\n\", \"type\": \"integer\", \"minimum\": 1 }, \"user\": { \"type\": \"string\", \"example\": \"user-1234\", \"description\": \"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\\n\" } }, \"required\": [\"model\", \"input\"] }" | |
} | |
}, | |
"required": [], | |
"type": "object" | |
} | |
} | |
}, | |
{ | |
"id": "runJavascript-b70ca9b3", | |
"type": "runJavascript", | |
"metadata": { | |
"visual": { | |
"x": 296, | |
"y": -135 | |
}, | |
"title": "make-input-schema-from-error", | |
"logLevel": "debug" | |
}, | |
"configuration": { | |
"name": "run", | |
"code": "function run(args) {\n console.log(args)\n if (\"$error\" in args) {\n \n return { \n //\"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"additional\": {\n \"type\": \"string\",\n \"title\": \"Additional Data\",\n \"description\": args.$error.inputs.json || args.$error.error.message,\n \"examples\": []\n }\n },\n \"required\": []\n }\n // }\n }\n return;\n}" | |
} | |
}, | |
{ | |
"id": "input-9dfbdaed", | |
"type": "input", | |
"metadata": { | |
"visual": { | |
"x": 649, | |
"y": -113 | |
}, | |
"title": "additional-data-input", | |
"logLevel": "debug" | |
} | |
}, | |
{ | |
"id": "promptTemplate-df5c15c1", | |
"type": "promptTemplate", | |
"configuration": { | |
"template": "{{text}}\n\nThe following data will override conflicting statements\n\n{{additional}}" | |
}, | |
"metadata": { | |
"visual": { | |
"x": 690, | |
"y": -428 | |
}, | |
"title": "ammend-prompt-with-new-data", | |
"logLevel": "debug" | |
} | |
} | |
], | |
"edges": [ | |
{ | |
"from": "text-2daa1e8a", | |
"to": "validateJson-eefab6f5", | |
"out": "text", | |
"in": "json" | |
}, | |
{ | |
"from": "validateJson-eefab6f5", | |
"to": "output", | |
"out": "json", | |
"in": "text" | |
}, | |
{ | |
"from": "promptTemplate-47d4a7bf", | |
"to": "text-2daa1e8a", | |
"out": "prompt", | |
"in": "systemInstruction", | |
"constant": true | |
}, | |
{ | |
"from": "input-a15bcc81", | |
"to": "text-2daa1e8a", | |
"out": "text", | |
"in": "text" | |
}, | |
{ | |
"from": "input-f44b216d", | |
"to": "promptTemplate-47d4a7bf", | |
"out": "theSchema", | |
"in": "schema" | |
}, | |
{ | |
"from": "input-f44b216d", | |
"to": "validateJson-eefab6f5", | |
"out": "theSchema", | |
"in": "schema" | |
}, | |
{ | |
"from": "validateJson-eefab6f5", | |
"to": "runJavascript-b70ca9b3", | |
"out": "$error", | |
"in": "$error" | |
}, | |
{ | |
"from": "input-a15bcc81", | |
"to": "runJavascript-b70ca9b3", | |
"out": "text", | |
"in": "text" | |
}, | |
{ | |
"from": "runJavascript-b70ca9b3", | |
"to": "input-9dfbdaed", | |
"out": "result", | |
"in": "schema" | |
}, | |
{ | |
"from": "input-a15bcc81", | |
"to": "promptTemplate-df5c15c1", | |
"out": "text", | |
"in": "text" | |
}, | |
{ | |
"from": "input-9dfbdaed", | |
"to": "promptTemplate-df5c15c1", | |
"out": "additional", | |
"in": "additional" | |
}, | |
{ | |
"from": "promptTemplate-df5c15c1", | |
"to": "text-2daa1e8a", | |
"out": "prompt", | |
"in": "text" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment