{"id":15787122,"url":"https://github.com/ubos-tech/node-red-contrib-openai-ubos","last_synced_at":"2025-05-13T01:33:33.985Z","repository":{"id":173620163,"uuid":"650027282","full_name":"UBOS-tech/node-red-contrib-openai-ubos","owner":"UBOS-tech","description":"A Node-RED node that interacts with OpenAI machine learning models to generate text like ChatGPT","archived":false,"fork":false,"pushed_at":"2024-02-29T11:00:15.000Z","size":49,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T21:43:11.310Z","etag":null,"topics":["ada-002","ai","chatgpt","chatgpt-api","code-generation","dall-e","embeddings","embeddings-model","flow","gpt-3","gpt-35-turbo-0301","javascript","machine-learning","no-code","node-red","nodejs","openai","text-embedding","text-generation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UBOS-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-06T07:15:12.000Z","updated_at":"2024-07-15T18:37:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"36ba809a-6d49-4b3a-88db-e629da396e6d","html_url":"https://github.com/UBOS-tech/node-red-contrib-openai-ubos","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.43999999999999995","last_synced_commit":"242d87c5a8fb3f214111eaa12448b0b301f3d3b0"},"previous_names":["ubos-tech/node-red-contrib-openai-ubos"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UBOS-tech%2Fnode-red-contrib-openai-ubos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UBOS-tech%2Fnode-red-contrib-openai-ubos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UBOS-tech%2Fnode-red-contrib-openai-ubos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UBOS-tech%2Fnode-red-contrib-openai-ubos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UBOS-tech","download_url":"https://codeload.github.com/UBOS-tech/node-red-contrib-openai-ubos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246639699,"owners_count":20810055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ada-002","ai","chatgpt","chatgpt-api","code-generation","dall-e","embeddings","embeddings-model","flow","gpt-3","gpt-35-turbo-0301","javascript","machine-learning","no-code","node-red","nodejs","openai","text-embedding","text-generation"],"created_at":"2024-10-04T21:05:19.950Z","updated_at":"2025-04-01T12:31:15.903Z","avatar_url":"https://github.com/UBOS-tech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## node-red-contrib-openai-ubos\n\nA Node-RED node that interacts with OpenAI machine learning models to generate text like ChatGPT.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"50%\" align=\"center\" alt=\"Ubos - End-to-End Software Development Platform\" src=\"https://ubos.tech/wp-content/uploads/2023/03/cropped-Group-21015-1.png\"\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n  \u003cb\u003e\u003ca href=\"https://ubos.tech/\"\u003eUBOS\u003c/a\u003e\u003c/b\u003e\n  •\n  \u003ca href=\"https://community.ubos.tech/\"\u003eCommunity\u003c/a\u003e\n  •\n  \u003ca href=\"https://www.youtube.com/@ubos_tech\"\u003eYoutube\u003c/a\u003e\n  •\n  \u003ca href=\"https://discord.com/invite/dt59QaptH2\"\u003eDiscord\u003c/a\u003e\n  •\n  \u003ca href=\"https://github.com/UBOS-tech\"\u003eGitHub\u003c/a\u003e\n\u003c/h3\u003e\n  \n\u003cdiv align=\"center\"\u003e\n \n[![flow](https://img.shields.io/badge/platform-Node--RED-red)](https://flows.nodered.org/node/node-red-contrib-openai-ubos)\n[![npm](https://img.shields.io/npm/v/node-red-contrib-openai-ubos)](https://www.npmjs.com/package/node-red-contrib-openai-ubos)\n \n\u003c/div\u003e\n\n### Quick Start\n\nInstall with the built in \u003cb\u003eNode-RED Palette manager\u003c/b\u003e or using npm:\n```\nnpm install node-red-contrib-openai-ubos\n```\n\n## Setup\n\nWhen editing the nodes properties, to get your `OPENAI_API_KEY` log in to [ChatGPT](https://chat.openai.com/chat) and then visit https://platform.openai.com/account/api-keys click \"+ Create new secret key\" then copy and paste the \"API key\" into the nodes `API_KEY` property value.\n\nTo get your `Organization` visit https://platform.openai.com/account/org-settings then copy and paste the \"OrganizationID\" into the nodes `Organization` property value.\n\n## Properties\n\n - `msg.OPENAI_API_KEY`: This is the API key provided by OpenAI. It is necessary for authentication when making requests to the OpenAI API.\n\n - `msg.prompt`: This string forms the initial text from which the model will generate its continuation.\n - `msg.model`: This property defines the name of the OpenAI model to be used for generating the text, for example, \"text-davinci-003\".\n - `msg.temperature`: This property controls the randomness in the output of the model. Higher values result in more random outputs. This is a numerical value.\n - `msg.max_tokens`: This property sets the maximum length of the model output. This is a numerical value.\n - `msg.messages`: This is an array meant to hold any messages that are to be passed along the Node-RED flow. Each object in the array can contain additional properties like `role` and `content`. For example:\n   ```json\n   \"messages\": [\n       {\"role\": \"system\", \"content\": \"Set the behavior\"},\n       {\"role\": \"assistant\", \"content\": \"Provide examples\"},\n       {\"role\": \"user\", \"content\": \"Set the instructions\"}\n   ]\n   ```\n - `msg.top_p`: This property is used when nucleus sampling is preferred for generating the text. The value for this property is expected to be a number between 0 and 1.\n - `msg.frequency_penalty`: This property allows for penalization of new tokens based on their frequency. The value should be a number between 0 and 1.\n - `msg.stop`: Up to 4 sequences where the API will stop generating further tokens. For example:\n   ```js\n   msg.stop = [\"word-1\", \"word-2\"]\n   ```\n - `msg.presence_penalty`: This property can be used to control the model's preference for introducing new concepts during text generation. Like `msg.frequency_penalty`, it should be a number between 0 and 1.\n\n**Example**\n   ```js\n    msg.OPENAI_API_KEY = \"your api key\";\n    msg.model = \"gpt-3.5-turbo\";\n    msg.messages = [\n       {\"role\": \"system\", \"content\": \"Set the behavior\"},\n       {\"role\": \"assistant\", \"content\": \"Provide examples\"},\n       {\"role\": \"user\", \"content\": \"Set the instructions\"}\n   ]\n   ```\n### Custom settings\n To send your custom settings for the OpenAI request, you can use the `msg.settings` parameter. Simply pass an object with all the necessary fields according to the OpenAI documentation.\n```js\nmsg.url = \"https://api.openai.com/v1/embeddings\";\nmsg.OPENAI_API_KEY = \"your API key\";\nmsg.settings = {\n    model: \"text-embedding-3-large\",\n    input: \"Hello World\"\n}\n```\n### Create embeddings\n When msg.model is set to text-embedding-ada-002:\n  - [Required] input: [Type: string or array] 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. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`) and cannot be an empty string. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens.\n\n  - user: [Type: string] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices).\n  ```js\n  msg.OPENAI_API_KEY = \"your api key\";\n  msg.model = \"text-embedding-ada-002\";\n  msg.input = \"Lorem Ipsum is simply dummy text of the printing and typesetting industry\";\n  ```\n\n## Demo\n\u003cimg width=\"1439\" alt=\"image\" src=\"https://github.com/UBOS-tech/node-red-contrib-openai-ubos/assets/41735477/53e6e194-7a0b-4e09-b811-5a5c4521640e\"\u003e\n\n\u003cimg width=\"1440\" alt=\"image\" src=\"https://github.com/UBOS-tech/node-red-contrib-openai-ubos/assets/41735477/086e3ada-7003-4a8c-8ae1-722c0acc238f\"\u003e\n\n### Bugs reports and feature requests\n\nPlease report any issues or feature requests at \u003ca href=\"https://github.com/UBOS-tech/node-red-contrib-openai-ubos/issues\"\u003eGitHub\u003c/a\u003e.\n\n## License\n\n[MIT License](https://github.com/UBOS-tech/node-red-contrib-openai-ubos/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubos-tech%2Fnode-red-contrib-openai-ubos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubos-tech%2Fnode-red-contrib-openai-ubos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubos-tech%2Fnode-red-contrib-openai-ubos/lists"}