Generating Relevant Random JSON with Chrome AI / / No Comments 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 Tagged with: Chrome, Generating, JSON, Random, Relevant
BoxLang Quick Tips – Working with JSON / / No Comments Welcome to another BoxLang quick tip – today I’m going to focus on working with JSON in BoxLang. Now, as you can probably guess, JSON is natively supported and supports what you would expect, going to and from JSON, but there’s some particularities of the support that may interest you, so I’ve dug into it. As with my other quick tips, you can skip to the video version at the bottom if you prefer. The Basics Converting data to JSON can be done two ways, either via the built in function (BIF) jsonSerialize or the member function toJSON. There’s no difference here, just use what makes sense for you: name = "Raymond"; age = 52; hobbies = ["beer","books","movies","video... more → Posted in: JavaScript Tagged with: BoxLang, JSON, Quick, tips, working
Using JSON Schema with Google Gemini / / No Comments Back about a month ago, I wrote up a post on how to generate JSON results using Google Gemini, "JSON Results with Google Gemini Generative AI API Calls". While you should read that post first, the process basically boiled down to: Setting the response type of the result to JSON. Without this, Gemini will return JSON but encoded in Markdown. Using a System Instruction to give directions on the "shape" of the JSON, i.e., use this key and that key. While these techniques work well, recently yet another feature was added that makes this even better, JSON schema support. JSON Schema is an abstract way to define the shape of JSON and can be really useful in validation. The website... more → Posted in: JavaScript Tagged with: Gemini, Google, JSON, Schema, using
JSON Results with Google Gemini Generative AI API Calls / / No Comments Forgive the somewhat alliterative title there, but today’s post covers something that’s been on my mind since I started playing with Google Gemini, specifically, how to get the results of your API calls in JSON. To be clear, the REST API returns a result in JSON, but I’m talking about the content of the result itself. Before I continue, a quick shot out to Allen Firstenberg who has been helping me off and on with Google Gemini stuff. Anything I get wrong though is entirely my fault. 😜 Ok, so before I go on, let’s look at a typical result. Take a prompt like so: "What is the nature of light". Pass this to Gemini via the API, and the result you get, once you... more → Posted in: JavaScript Tagged with: Calls, Gemini, Generative, Google, JSON, results