Saturday, December 16, 2023

AI: OpenAI Prompt "Engineering" guide

the "engineering" is not appropriate name for making "prompts"
It should be called "psychology", a "soft skill"

In any case, asking good questions is important skill, apparently even with AI.
And this is a useful guide.

Prompt engineering - OpenAI API

"These models can’t read your mind. If outputs are too long, ask for brief replies. If outputs are too simple, ask for expert-level writing. If you dislike the format, demonstrate the format you’d like to see. The less the model has to guess at what you want, the more likely you’ll get it. Tactics:
1. Use the latest model

8. Code Generation Specific - Use “leading words” to nudge the model toward a particular pattern


Asking right questions is an antient "philosopher" skill:

Socratic method is a form of argumentative dialogue between individuals, based on asking and answering questions. It is named after the Classical Greek philosopher Socrates

An irony of this is that Socrates died as punishment for asking all those questions...

Socrates - Wikipedia
In 399 BC, Socrates was formally accused of corrupting the minds of the youth of Athens, and for asebeia (impiety), i.e. worshipping false gods and failing to worship the gods of Athens.


"Open AI just released an incredible Prompt Engineering guide." Post | Feed | LinkedIn


JS "ternaries" in Prettier(.js)

good, or confusing?

"case-style" ternaries make sense; nested are not readable, to me at least.

 A curious case of the ternaries · Prettier

a quick, contrived example to show the thinking behind "curious" ternaries:

    const animalName =
      pet.canBark() ?
        pet.isScary() ?
          'wolf'
        : 'dog'
      : pet.canMeow() ?
        'cat'
      : 'probably a bunny';
    


    And here's the code rewritten to demonstrate "case-style" ternaries:

    const animalName =
      pet.isScary() ? 'wolf'
      : pet.canBark() ? 'dog'
      : pet.canMeow() ? 'cat'
      : 'probably a bunny';