Using ChatGPT node in your agent
The ChatGPT Node allows you to bring powerful AI capabilities into your agent. With just a few steps, you enable your agent to process natural language inputs and respond intelligently.
Last updated
The ChatGPT Node allows you to bring powerful AI capabilities into your agent. With just a few steps, you enable your agent to process natural language inputs and respond intelligently.
Last updated
Before you begin, ensure you have:
An API Key from the OpenAI platform.
You can follow OpenAI's official guide to get your API key
The final agent is setup as below:
Add the ChatGPT Node
From the Node Library on the left panel, expand the Llm section.
Drag the ChatOpenAI node onto your workspace.
Configure the ChatGPT Node
API Key:
Paste your OpenAI API key into the apiKey
field of the node.
This key authenticates your requests to OpenAI’s servers.
Model Name:
The default model is gpt-4
(or gpt-3.5-turbo
if you prefer).
Specify the model in the modelName
field.
Temperature (Optional):
This controls the randomness of the AI’s responses.
A value of 0
gives deterministic responses, while higher values introduce more variability.
Schema:
For our example, the schema can be ignored since we’re working with a simple string input.
Error Handling:
We’re skipping error handling for now, but this can be added later to manage API errors.
Connect the Nodes
Execution Flow (Exec):
Connect the exec
port of the Input Node to the exec
port of the ChatOpenAI node.
Then, connect the exec
port of the ChatOpenAI node to the exec
port of the Output Node.
Message Flow:
Connect the message
port of the Input Node to the message
port of the ChatOpenAI node.
Finally, connect the response
port of the ChatOpenAI node to the message
port of the Output Node.
Test Your Agent
Use the Message Box at the bottom-right to send a message (e.g., “Hi”).
Observe the response:
Your input message is processed by the ChatGPT Node and returned through the Output Node.
For example, if you type “Hi,” you might receive “Hello! How can I assist you today?”
By integrating the ChatGPT Node, your agent can now handle conversational input and provide intelligent, context-aware responses. Let’s move forward to building more advanced workflows!