Backstory:
The genai
library for Go provides a rather unfortunately opaque interface for responses, and all of the example code I’ve seen carefully avoids actually assembling the response into a useful string. I can do the type switch dance and do it myself, but I had hoped there was a more brilliant solution I was overlooking, or a useful helper function. (I strongly encourage the Go SDK developers to add some easier ways to get the text output from their model responses.)
The Experience Report:
Anyways, in trying to explore the options, I pasted this code into AI studio then asked it how to convert a Part into a string. It came up with a for-loop around a switch, which is fine. Then I asked it whether there were any useful helper functions, and both 2.0 Flash and Experimental 1206 insisted that yes, there were relevant helper functions. I re-ran it multiple times for each, and they would bloviate for awhile until they looked like they were just very confused. The “useful” helper functions they pointed to were not even remotely useful for the given task.
What was especially interesting is that 1.5 Flash immediately and pointedly responded by saying that no, the code did not contain useful helpers for this task. So this seems to be a regression in the model training.
1.5 Flash’s response is by far the most helpful here. I understand there’s a balance to be struck, and maybe 1.5 Flash is on the wrong side of things more often than not, but it seems like the newer models were reading too much into my question and assuming that I knew there were useful helpers, and that it was a leading question, not an earnest question.
(I tried to attach multiple images, but it won’t let me.)
(EDIT: attached them as separate replies.)