ColdFusion Component for Google Gemini

This week I had the pleasure to present on Google Gemini at the ColdFusion Summit. If you weren’t able to make it, I do plan on giving the talk again on the ColdFusion Meetup sometime later this year. After the presentation, I took my ‘rough and ugly’ code that called Gemini and decided to wrap it up in a nice ColdFusion component. This allows for (hopefully) easier use. For example: gemini = new gemini(key="your key", model="gemini-1.5-pro");result = gemini.prompt('why is the sky blue?'); And that’s it. The result variable will contain two keys, a raw value that is exactly what Gemini returned, and a text value that narrows down into the text response. Multimodal... more →
Posted in: JavaScript

Using Google Gemini’s File API with ColdFusion

I promise, I’m not turning this back into a ColdFusion blog, but as I prepare my presentation next week at Summit and update my Google Gemini code for some ColdFusion demos, I ran into a particularly gnarly bit that I wanted to share in a post. For the most part, I’ve had no issues using Gemini’s REST APIs in ColdFusion, but the File API ended up being more difficult. If you go the documentation for uploading, and use the ‘Shell’ language tab, you can see an example like so: MIME_TYPE=$ (file -b --mime-type "$ {IMG_PATH_2}")NUM_BYTES=$ (wc -c < "$ {IMG_PATH_2}")DISPLAY_NAME=TEXTtmp_header_file=upload-header.tmp# Initial resumable request... more →
Posted in: JavaScript

Parsing Markdown in ColdFusion

Welcome to my third, yes, third, ColdFusion post in 2024. Is it a trend? Who knows. That being said, I’m doing some prep work to update my presentation on Google Gemini in preparation for my talk at Adobe’s ColdFusion Summit later this month, I’m updating my Node.js demos to ColdFusion and ran into an interesting issue – converting Markdown responses from Gemini to HTML. Edit: I realized I gave my function at the bottom a dumb name. I updated the code to reflect a better name on 9/18/2024 My first quick Google searches didn’t really mesh well with what I expected, so I asked on the CFML Slack and James Moberg pointed out a few options, but suggested I focus on Flexmark... more →
Posted in: JavaScript

Automating Mastodon Postings with ColdFusion

I’ve had a lot of fun building Mastodon bots (see my list of super-important business critical bots as an example), typically using the Pipedream platform, and more recently, Cloudflare Workers. The Mastodon API is kinda stupid easy and with "The Other Network" going to hell in a handbasket, I don’t see myself building bots anywhere else. Just yesterday I came home from the Adobe ColdFusion Summit and I thought it would be fun to see how easy it would be to build a Mastodon bot in ColdFusion. Here’s what I was able to do in roughly ten minutes. First, don’t forget that to add automation to a Mastodon account, you need to go into your preferences, select the "Development"... more →
Posted in: JavaScript

ColdFusion Component for Adobe Acrobat Services

Last month, I wrote up a post demonstrating how to use Adobe Acrobat Services with ColdFusion. This week I took some of the code I had written for that post and turned it into a proper GitHub project. You can find the latest code here: https://github.com/cfjedimaster/coldfusion-cfc-acrobat-services To use this, you’ll need credentials, which you can get and use for free for up to 500 transactions. (The docs go into detail about how that works.) Currently I only have a subset of our APIs supported, but I plan to hit most of the rest in the next day or so. To give you an example of how it works, here’s a sample that uses our Extract API. First, you instantiate the component with your... more →
Posted in: JavaScript

Integrating Acrobat Services with ColdFusion

Last week I shared a look at how to integrate the Adobe Photoshop API with ColdFusion, and that got me itching to see how difficult it would be to do the same with our Acrobat Services. While ColdFusion has native PDF features built-in, I think there are aspects of the platform that may be of use to CF developers. The Acrobat Services Platform # Let’s start by briefly describing what Acrobat Services are. At a high level, they’re all about document management via APIs. Broadly the services are categorized like so: PDF Services – this is the "catch-all" bucket of services that do simple things like converting to and from PDFs, splitting, merging, and so forth. This... more →
Posted in: JavaScript