Brain is a GPT-powered Grasshopper component that lets you control your scripts through natural language.
Remember that this tool only lets you manipulate your Grasshopper script using the parameters and the parameter domains that are already in your script. If you're interested in generating scripts using natural language, check out GHPT.
Installation can be done in one of three ways. After installation, the component may be found here.
Install the plug-in from Food4Rhino.
Install Brain's Yak package from Rhino's Package Manager.
For a more in-depth guide about building plugin files from source code, check out this thread by Guilio Piacentino on the Rhinoceros Forums.
- To be able to use your API Key, set up billing at OpenAI's Billing Page.
- Then go the OpenAI's API Keys Page to generate your API Key.
- Paste the key in your Grasshopper script within a panel, or save it in a secure location as you won't be able to retrieve it again.
For more information about API Costs, check out OpenAI's Pricing
- Make sure Rhino is connected to the internet.
- It is important to name all your connected sliders before using the component.
- For the component to work properly, the sliders have to be connected directly without any kind of geometry filters.
You may also find example files here.
This flowchart explains how the component is used:
graph LR;
A((OpenAI \nAPI Key)) --> B[Data];
C((Script \nDescription)) --> B;
D((Script \nParameters)) --> B;
B --> H{Component};
E((Trigger \nButton)) --> F[Run];
F --> H{Component};
This flowchart explains how the component gathers data about the parameters and sends an API call to OpenAI:
graph LR;
A((Plugin Context)) --> E;
B((.gh Description)) --> E;
C((Param Data)) --> G;
D((Text Prompt)) --> G;
E[System Prompt] --> F{POST Request \nto OpenAI};
G[User Prompt] --> F;
F -->|JSON| H[Parse Response];
J[Set up function \nto change \nparameters] --> I{Call Function};
H --> I;
J --> A;
Plugin Context is a short description about the component that goes into the system
part of the prompt for the GPT3.5 API call. This part remains the same in every case and helps the model understand the context of the component.
.gh Description is a short description about the Grasshopper script that also goes into the system
part of the prompt for the API call. This part is different for every case every case and is typed out by the user and plugged in to the component. This helps the model understand the context of the script itself.
Param Data is a set of all the parameters you would want to control, provided they are connected to the component. This chunk of text goes into the user
part of the prompt for the API call and is collected everytime to account for any changes in the parameters.
Text Prompt is a short sentence in natural language describing what you want the component to do. This chunk of text also goes into the user
part of the prompt for the API call and is arugably the most important part of the component.
Copyright (C) 2023 lolrazh
The project 'Brain' is licensed under the GNU Lesser General Public License v3.0. For more details, please refer to the LICENSE file.
- Kaushik LS for helping me compile this project and for his other valuable inputs.
Do you like my work? Buy me a coffee :)