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…


This content originally appeared on Raymond Camden and was authored by Raymond Camden

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 prompts are also somewhat simple:

fileOb = gemini.uploadFile(expandPath('./cat1.png'));result = gemini.prompt('what is in this picture?', [ fileOb ]);writedump(result);

And you can use multiple files at once:

fileOb2 = gemini.uploadFile(expandPath('./dog1.png'));result = gemini.prompt('what is different in these pictures??', [ fileOb, fileOb2 ]);writedump(result);

There's still more I'd like to add, specifically support for safety settings and chat, but for now, you can find the code here: https://github.com/cfjedimaster/gemini.cfc

I am, admittedly, somewhat rusty with ColdFusion, so I'm happy to take PRs that simply update my syntax to more modern conventions I may have missed. Just let me know!


This content originally appeared on Raymond Camden and was authored by Raymond Camden


Print Share Comment Cite Upload Translate Updates
APA

Raymond Camden | Sciencx (2024-10-03T18:00:00+00:00) ColdFusion Component for Google Gemini. Retrieved from https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/

MLA
" » ColdFusion Component for Google Gemini." Raymond Camden | Sciencx - Thursday October 3, 2024, https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/
HARVARD
Raymond Camden | Sciencx Thursday October 3, 2024 » ColdFusion Component for Google Gemini., viewed ,<https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/>
VANCOUVER
Raymond Camden | Sciencx - » ColdFusion Component for Google Gemini. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/
CHICAGO
" » ColdFusion Component for Google Gemini." Raymond Camden | Sciencx - Accessed . https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/
IEEE
" » ColdFusion Component for Google Gemini." Raymond Camden | Sciencx [Online]. Available: https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/. [Accessed: ]
rf:citation
» ColdFusion Component for Google Gemini | Raymond Camden | Sciencx | https://www.scien.cx/2024/10/03/coldfusion-component-for-google-gemini/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.