June 20, 2023, 3:07 p.m. | Alexey Kramin

DEV Community dev.to

I've been implemented a JavaScript AI emoji generator recently. And as OpenAI API responses are not always consistent, or maybe my prompts are far from ideal, I needed to create a backup function that generates random emojis if the response is not parsed properly.


Surprisingly, I found that functions might more look like an instruction for a person than for a machine in future 😅. Here is what I mean:



// regular JS function
function getNEmojis(n) { …

ai api backup consistent emoji found function functions generator javascript node openai openai api programming prompts random responses text

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne