ell-hol / Brain

Brain is a GPT-powered Grasshopper component, that lets you control your scripts through natural language.

Home Page:https://www.food4rhino.com/en/app/brain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brain

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

Installation can be done in one of three ways. After installation, the component may be found here.

Food4Rhino

Install the plug-in from Food4Rhino.

Package Manager

Install Brain's Yak package from Rhino's Package Manager.

Build from source

For a more in-depth guide about building plugin files from source code, check out this thread by Guilio Piacentino on the Rhinoceros Forums.

API Key Configuration

  1. To be able to use your API Key, set up billing at OpenAI's Billing Page.
  2. Then go the OpenAI's API Keys Page to generate your API Key.
  3. 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

How to Use

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

How it Works

The Component

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};

The “AI”

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.

License

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.

Acknowledgements

  • Kaushik LS for helping me compile this project and for his other valuable inputs.

Support

Do you like my work? Buy me a coffee :)

About

Brain is a GPT-powered Grasshopper component, that lets you control your scripts through natural language.

https://www.food4rhino.com/en/app/brain

License:GNU Lesser General Public License v3.0


Languages

Language:Python 100.0%