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.

Prerequisites

Before you begin, ensure you have:

  1. An API Key from the OpenAI platform.

    • You can follow OpenAI's official guide to get your API key


Step-by-Step Guide

The final agent is setup as below:

Agent integrated with ChatGPT node
1

Add the ChatGPT Node

  1. From the Node Library on the left panel, expand the Llm section.

  2. Drag the ChatOpenAI node onto your workspace.

2

Configure the ChatGPT Node

  1. API Key:

    • Paste your OpenAI API key into the apiKey field of the node.

    • This key authenticates your requests to OpenAI’s servers.

  2. Model Name:

    • The default model is gpt-4 (or gpt-3.5-turbo if you prefer).

    • Specify the model in the modelName field.

  3. Temperature (Optional):

    • This controls the randomness of the AI’s responses.

    • A value of 0 gives deterministic responses, while higher values introduce more variability.

  4. Schema:

    • For our example, the schema can be ignored since we’re working with a simple string input.

  5. Error Handling:

    • We’re skipping error handling for now, but this can be added later to manage API errors.

3

Connect the Nodes

  1. 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.

  2. 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.

4

Test Your Agent

  1. Use the Message Box at the bottom-right to send a message (e.g., “Hi”).

  2. 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?”


What’s Next?

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!

Last updated