Grasshopper Developing
AI Completion-Aided Design starts from answers – OpenAI Completion mode (GPT-3 chatbot)

William Gibson’s uchronia in the field of design is about to happen?

“AI gift…” a provocative image-art by Luciano Ambrosini

The evolution of artificial intelligence is, as is widely known, the progress made in the field of mathematics in the broadest possible sense. Recently I’m dealing with the coding of some Grasshopper components able to perform the prediction request procedure offered by the OpenAI platform. Thanks to the API (Application Programming Interface) I have recently implemented the possibility of using the Text Completion mode elaborated by OpenAI.
The completions endpoint can be used for a wide variety of tasks. It provides a simple but powerful interface to any of our models. You input some text as a prompt, and the model will generate a text completion that attempts to match whatever context or pattern you gave it. For example, if you give the API the prompt, “As Descartes said, I think, therefore”, it will return the completion ” I am” with high probability. The actual completion you see may differ because the API is stochastic by default. This means that you might get a slightly different completion every time you call it, even if your prompt stays the same. You can control this behaviour with the temperature setting.

This simple text-in, text-out interface means you can “program” the model by providing instructions or just a few examples of what you’d like it to do. Its success generally depends on the complexity of the task and the quality of your prompt. A good rule of thumb is to think about how you would write a word problem for a middle schooler to solve. A well-written prompt provides enough information for the model to know what you want and how it should respond.

The LA_OpenAI-GH_Ask ghuser component uses the OpenAI GPT-3 models (Generative Pre-trained Transformer 3 – see here) a set of models that can understand and generate natural language. The main GPT-3 models implemented are: 

LATEST MODEL DESCRIPTION MAX REQUEST TRAINING DATA
text-davinci-003 Most capable GPT-3 model. Can do any task the other models can do, often with higher quality, longer output and better instruction-following. Also supports inserting completions within the text. 4,000 tokens Up to Jun 2021
text-curie-001 Very capable, but faster and lower cost than Davinci. 2,048 tokens Up to Oct 2019
text-babbage-001 Capable of straightforward tasks, very fast, and lower cost. 2,048 tokens Up to Oct 2019
text-ada-001 Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost. 2,048 tokens Up to Oct 2019
For extra info see the OpenAI models description

 

Stepping back to my “Ask to AI” Grasshopper component, I have left all the models elaborated by OpenAI researchers, to leave the possibility of discovering which combination of predictions, and therefore of answers, can come out. So to maximize the simplification in terms of input parameters I left: APIkey, Engine, DirPath, Prompt, MaxTkn, Temp, TopP and start – For full descriptions see them in Grasshopper by hovering with the mouse on input parameters. In particular Temp and TopP which stand for temperature and mass of probability, allow altering the results (they can assume a value between 0.0 and 1.0).

Now LA_OpenAI-GH_Ask component is available on my GitHub page

 

Briefly in order to run Completion mode you need:

  • API Key (your OpenAI API key);
  • Engine (select a models among babbage*, ad*, davinci* and curie*);
  • DirPath:a full path where saving all answers;
  • Text prompt (as a question prompt but not only);
  • MaxTkn: depends on the availability of your tokens – good value starts from 100, but you can give it a try;
  • Temp: consistency with the question asked (>0.0 more creativity added);
  • TopP: una percentuale di contenuti più probabili e coerenti;
  • start: run the component;

This component, like all the others programmed to interact with AI inside Grasshopper, generates a TXT file as shown below:

The filename contains the first half of your prompt (a limited length) and the second half the “creation id” generated by the OpenAI server. The TXT file contains:

  • 1- Credits info;
  • 2- Your question/prompt;
  • 3- The OpenAI answer (which depends on the engine model);
  • 4- Extra info from OpenAI server;

 

COMPLETION mode

Coded components in action:

Example 01:
Q – How to improve building comfort in a dry climate zone?


Example 02:
Below I “told” OpenAI to generate a text prompt for generating a generative-art image by DALL-E

Extra generations are below

 

It can be useful for supporting you in generating codes (like Python, C# and so on…) a sort of man + machine coop – anyway, you need to play with this smart “chatbot” before reaching a satisfactory result

I have asked to generate a python code

Since Build 105 Since output files are packed in a TXTs folder (all text prompts) and finally this build creates a CSV file as LOG output of all the AI requests and generation processes.

Here below the video DEMO

 

Why this remind me to William Gibson’s uchronia?

The term uchronia refers to a hypothetical or fictional time period of our world, in contrast to altogether-fictional lands or worlds. The concept is similar to alternate history, but uchronic times are not easily defined but are placed mainly in some distant or unspecified point before current times, and they are sometimes reminiscent of a constructed world (source: Wikipedia). This type of historical evolution is recalled in the novel The Difference Engine by William Gibson & Bruce Sterling, a 1990 cyberpunk/steampunk novel in which the vicissitudes of the analytical engine of the British mathematician, philosopher and proto-computer scientist – Charles Babbage –  were retraced in a fictionalized key.
The scenario that derives from it and that forms the background to the novel is thus that of a Victorian England very different from the historical one, where technology has made great strides churning out strange machines and creations that mix progress in the field of information technology with state-of-the-art steam. Immense punched card machines are at the service of science as well as her majesty’s police and secret services, whose power of action is thus greatly amplified.

In my opinion, the parallel is very close to the effect that artificial intelligence is generating in each professional field and in the daily life of all of us. In professional terms and in the field of architecture and design, the possibility of questioning a “machine” with enormous “self-learning powers” somehow gives us hope (or at least it is what arouses in me personally) the vision of collaborating in also educational sense with AI and to enhance and improve production (design) results. In this sense, the OpenAI researchers perhaps wanted to pay homage to the first software developer in history: Ada Lovelace (one of the GPT-3 model names1ada, davinci, babbage and curie, seem to refer to the most important scientists characters of all time in terms of inventions, and new ways to spread and feed innovation in each different historical era), born exactly 200 years ago from the poet Lord Byron and the mathematician Annabella Milbanke, understood before all the others that programming is not just about numerical entities, but any other reality that can be expressed in symbols. But that’s not all: her vision of things, in which art and technique intertwined, in which poetry and mathematics were one, was too far ahead of her times and even for those that followed: for decades this young mathematician remained unknown to more.

In recent years, this statement has gradually faded, thanks to artificial intelligence. Ada was commissioned to review part of Babbage’s writings and the work of Count Luigi Federico Menabrea in reference to his analytical engine presented at the Turin Academy of Sciences in 1840 at the Congress of Italian scientists. Her notes,  in my opinion, help us reflect on this Digital Era, especially about the meaning of computers and the fate of artificial intelligence.

The computer will be a multifunctional machineMaking a mechanism capable of combining general symbols, in unlimited sequences of variety and extension, means having found a point of union between the operations of matter and the abstract processes of the mind“, reads one of the notes to the text of Menabrea. In one sentence, about 172 years ago, Ada understood what lies at the basis of modern software programming: a multifunctional and programmable machine based on a system of punched cards could have archived, manipulated, processed and present any reality that can be express in symbolic terms such as music or words, not just numbers. Unlike Babbage, who focused on the algebraic aspect of the machine, Ada had focused her attention on non-numerical realities for the first time, foreseeing the future role of the computer as an all-purpose machine.

The fate of artificial intelligence Not least is his insight into artificial intelligence. Lovelace anticipates the ability of machines to learn and develop increasingly complex solutions, but also highlights its limits: in her comments on the translation, she declares that “The analytical engine has no claim to conceiving anything”, but that it can only execute commands that are given to her. This statement, taken up a century later by Alan Turing and christened “Lady Lovelace’s objection”, still constitutes one of the pillars on which current research on artificial intelligence is based. Even if, in reality, today we are trying to demonstrate the opposite, trying to teach machines autonomous thinking.

At the end of these observations, or if you prefer these shared reflections over a good coffee or tea, they leave us a simple warning that is always worth keeping in mind however trivial it may be considered. That is, the constant formalization and disclosure of the “theory of incompleteness” – which in the Difference Engine by Gibson and Sterling gives a nod to the two Gödel’s Theorems – and which in a very, very paraphrased way I could explain it as the impossibility of demonstrating a certain ability of AI to conceal the expressive coherence of thought and reasoning typical of man, but which at the same time arouses a certain fascination if analyzed in terms of potential, visions, or better suggestions, to the human race (as if we placed ourselves in the condition external to Gödel’s formal system) and, precisely in this abstraction, to refute not the subrogation of AI to man, but rather what is still to be discovered in the system of human interactions on the world around him.

Leaving aside my personal digression and wanting to further simplify the reasoning, you don’t find the possibility of being able to “ask” an “entity” (seemingly omniscient) for solutions, ideas, and suggestions capable of improving our own connection with the things and people around us particularly fascinating? And isn’t this the “ordering and creative” aspect that an architect, designer or simply computational designer is constantly asked to exhibit in every phase of the design project? And aren’t the small imperfections or unexpected results that make us believe that a divine spark has illuminated one’s design path?
– Many complex questions require, in my opinion, a few simple answers.

I couldn’t resist..but it made me smile

Enjoy your personal design exploration! 😉

Here below the video DEMO

 

Download this component from HERE 

 

  • 1
    ada, davinci, babbage and curie, seem to refer to the most important scientists characters of all time in terms of inventions, and new ways to spread and feed innovation in each different historical era