Generating Relevant Random JSON with Chrome AI

A few weeks ago I blogged a demo where I used Chrome’s on-device AI feature to parse a "generic template language" and return random strings. If you’re so inclined (and of course you are), you can read that post here: "Creating a Generic Generative Language with Chrome AI". The idea was to give the AI model a template string that described what was random, and how it was random (this is a name, this is a number, this is a color, etc) and have the model fill in the blanks with appropriate values. At work, I’ve been digging into our platform and trying to learn as much as possible. One of the cooler features of Webflow is the CMS. You define a collection (type... more →
Posted in: JavaScript

Checking for Spam Content with Chrome AI

Earlier this week I mentioned I’m looking at my previous server-based generative AI demos and seeing which could possibly make sense using on-device AI with Chrome’s AI support. I remembered a demo from last year where I tested spam detection using Google Gemini. That demo had worked out rather well and so I thought I’d try it out in Chrome. Ok, but why? Spam detection is important, and a server-based solution could have many users, especially in sites that make use of a lot of user generated content. But what would be the point doing this in the browser? Consider the fact that many of the Chrome AI APIs help with writing, I think such a solution could be useful in helping flag... more →
Posted in: JavaScript

Creating a Generic Generative Language with Chrome AI

As I explore Chrome’s on-device AI initiatives, one of the things I’m doing is looking at some of my older demos (kinda funny to think of ‘old’ GenAI demos) and seeing which may make sense in the browser versus API calls. Last July, I investigated creating a template language parser with Google Gemini. The idea was – take a string with tokens that defined a type of word and have Gemini replace it. So for example: My name is {{ name }} and my favorite food is {{ food }}. I asked Gemini to look for values inside brackets, use that as the seed of a random word, and replace it. So for example: My name is Frederic Dinglehooper the 3rd and my favorite food is sushi. I... more →
Posted in: JavaScript

Adding Generative Summaries with Chrome AI

Earlier this year (sigh, when I had a job), I built a demo using Chrome’s built-in AI support to do something I thought was really interesting – progressively enhance product reviews to make it easier to see which were trending negative versus positive. It was a great example (imo!) of how AI support could enhance the experience in supported browsers without impacting the experience for others. That demo was on my mind this week, and it occurred to me that it would also be a great place to add summarization. The Summarizer API is now fully released, for Chrome that is, and does not need a flag enabled or anything like that. I’ve blogged about this API a few times already, most... more →
Posted in: JavaScript

Using Chrome AI to Summarize Comic Books

A few weeks back, I blogged about analyzing comic books with gen ai, and honestly, it worked really darn well. I extracted the pages with Python, and send them to Google Gemini to create the summary. I was naturally curious to see if this could be done entirely on device, using Chrome’s AI support. Here’s what I found. First, a reminder – a few days ago I updated my web-based comic book reader and described that process. The code I’m sharing today is built upon that first application, so if you missed that post, I’d strongly suggest reading it first. (And if you don’t want to miss any of my posts, don’t forget to subscribe!). How It Works Alright –... more →
Posted in: JavaScript

Adding Programming Language Detection with Built-in Chrome AI

As I’ve been playing, and thinking, more and more about how to best add Chrome AI support to web apps, I came across an interesting use-case that I think could be helpful, and like in my previous examples, be completely ok if it didn’t actually work. When I write on the developer blog at Foxit, I make use of WordPress plugin for code samples. This editor has a place for you to both paste in your code, and select the language so the proper highlighter is used: This works well enough, but it gets a bit annoying to have to constantly keep selecting Python in the dropdown. Ideally the form would use the last language (simple enough via LocalStorage), but I was curious how well Chrome’s... more →
Posted in: JavaScript

Using Chrome AI for Sentiment Analysis (Again)

Every now and then I get an idea for a blog post/demo, prepare to write about it, and realize I’ve actually covered the topic in the past. Sometimes, though, it works out really well especially when the technology has changed quite a bit. Almost a year ago, I blogged about doing sentiment analysis with Chrome’s AI upcoming AI feature. At the time, it worked…. ok. The biggest issue at the time was the inability to provide a system instruction to the model as well as being able to shape the response a particular way. Thankfully, both of those are now supported. As a reminder, the prompt API for the web is still in an origin trial, see the docs for more information and join the... more →
Posted in: JavaScript

Progressively Enhancing Product Reviews with Chrome AI

While writing up my last blog post I mentioned that a new idea had occurred to me in regards to employing sentimenet analysis with Chrome’s built-in AI support (that, remember, is still way in beta). At lunch today I took a quick stab at a simple demo of what I had in mind and honestly, I’m pretty happy with how it came out. The Initial Demo The idea I had was an "imagined" ecommerce site with product reviews. I went to Google AI Studio and used a prompt to generate a set of product reviews. I used this prompt: Generate a list of 20 product reviews for a cat carrier named Cat Carrier Ultra 1000. The reviews should be a mix of positive and negative, with some being extremely... more →
Posted in: JavaScript
1 2 3