Custom Node developed to facilitate the use of the ChatGPT API for chat completion within Dynamo
- OpenAI Account Setup
- OpenAI API Key
- Add credits to your Organization account in the Billing section
- Install the DynamoChatGPT package in your Dynamo
- Search for
DynamoChatGPT
in the Dynamo package search and install the package as shown in the image below
- Download and open the sample script from this repository
- Setup the inputs:
-
prompt (required): The prompt (message) you want to send to ChatGPT
-
api_key (required): Your OpenAI API Key
-
organization_id (optional): Your Organization ID
-
project_id (optional): Your Project ID, under
Project > General
-
model (required): ID of the model to use. Learn more here!
If you have ChatGPT Plus, we recommend using the
gpt-4o
model or newer, otherwise, usegpt-3.5-turbo
or the latest free version -
temperature (optional): OpenAI description:
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
-
max_tokens (optional): OpenAI description:
The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.
-
top_p (optional): OpenAI description:
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
-
frequency_penalty (optional): OpenAI description:
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
-
presence_penalty (optional): OpenAI description:
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
-
clear_history (optional): Set
true
, if you want to clear the chat history before sending the request, otherwise setfalse
This script stores the conversation history in
%appdata%\AECOder\dynamochatgpt\history.json
-
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for more details.