Menu

1 / 4

7 Things an AI API Response Tells You That Most Code Throws Away

JavaScript in Plain English - Medium·Ferid Brković·7 days ago
#htHZrYyW
Reading 0:00
15s threshold

Member-only story

7 Things an AI API Response Tells You That Most Code Throws Away

One line reads the text. The finish reason, the refusal, the tool call ids, the token bill and the headers go in the bin with the box.

Ferid Brković

10 min read12 hours ago

--

Press enter or click to view image in full size

You order a mug. The box arrives, you lift the mug out, and the packing slip, the receipt and the warranty card go in the bin with the cardboard. Most code treats the reply of an AI API the same way: one line takes the text, and everything else that came in the box is thrown out.

This is the line:

// The line almost every tutorial ends with.

export function naiveReply(data) {

return data.choices[0].message.content;

}

And this is what it returns for five different sample responses:

== A.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.