Using GenAI to Help Pick Your D & D Class

A few weeks back I wrote up my experience with generative AI as a dungeon master. That post ended up being really popular and got me thinking about other ways I could integrate D & D, or other games, with Generative AI. With Gemini 1.5 now available via API, I thought it would be good to find an excuse to hit the API in a demo. So with that in mind, I’d like to introduce you to the Class Suggester. The Application # The app begins by simply presenting some introductory text and invites you to click a button to roll for your stats. You can hit the Roll Stats button as many times as you want. It uses the standard D & D rule of rolling a six-sided dice four times and removing the... more →
Posted in: JavaScript

Using GenAI to Classify an Image as a Photo, Screenshot, or Meme

File this under the "I wasn’t sure if it would work and it did" category. Recently, a friend on Facebook wondered if there was some way to take a collection of photos and figure out which were ‘real’ photos versus memes. I thought it could possibly be a good exercise for GenAI and decided to take a shot at it. As usual, I opened up Google’s AI Studio and did a few initial tests: I then simply removed that image and pasted more info to test. From what I could see, it worked well enough. I then took the source code from AI Studio and began working. The Code # First, I grabbed some pictures from my collection, eleven of them, and tried to get a few photos, memes,... more →
Posted in: JavaScript

Function Calling and GenAI

I love when I work on one demo, hit an issue, discover something else and get joyfully distracted into learning something completely different. In this case, it was a suggestion to help with an issue I was having with output from a prompt, and while it wasn’t a good solution for what I was doing, it was an eye-opening look at a really cool feature of Generative AI – Function Calling. Now, I’m new to GenAI, and new to this particular feature having been introduced to it a bit less than twenty-four hours ago. I know it’s supported by Google AI APIs as well as OpenAI and a quick search around other offerings seems to imply it’s a universal thing. I want to give a quick... more →
Posted in: JavaScript

Can GenAI help you win in Vegas?

No. Thank you and goodbye. Ok, first off, I apologize for the click-bait style title. Every now and then when I get an idea for a demo, it doesn’t work. But sometimes, it doesn’t work out in a fun and interesting way, and I figure it’s a good idea to share it anyway. (Also, there’s always the strong chance that it didn’t work out because I did something wrong!) Today’s demo is a perfect example of that I think. Earlier this year I built a Blackjack game using Alpine.js and the quite excellent Deck of Cards API. Yesterday I was thinking about the game and I wondered – what would happen if I used generative AI to ask for help when playing it? So for example,... more →
Posted in: JavaScript