ColdFusion connecting to API

Wondering if anybody has used OpenAI API with ColdFusion? No comments on CF. This is an older website that the customer does not want to re-write at this time but does want to try incorporating AI into it for like questions/answers. I am always for stealing somebody else’s code. lol

I’ve implemented it on a couple coldfusion sites, and have had different results. Two of them work perfectly, one will connect 1 time and then not connect again for a time frame which I am trying to nail down. I think it’s because of the TLS but I am getting very slow server support. I had to set up a Flask API for that one to work around it. But let me move some code over to GitHub on the working versions and I’ll post a link back here.

If it doesn’t work, you might have the same TLS issue (That’s where I’m at anyway, might be way off with TLS. But I can’t prove I’m wrong yet).

I started a repository on Github and added Davinci to it. I’ll add a ChatGPT example next.

I keep getting weird errors come back with my code. It will connect but say something like Unrecognized request argument supplied: messages . I’ll look at what you’ve got to see if I can figure it out. I hadn’t thought of TLS issues.

I did finally get this resolved. It came down to a Java patch in 11.0.19.

If you access your ColdFusion administrator settings and look at the settings summary, about 10 lines down, it will tell you what Java version you have.

I was on an earlier 11 minor version. The only update I could find on the Oracle website was 11.0.18, and that version does not work.

The server administrators somehow got a version 11.0.19, and now it works perfectly. It was a patch within that update that fixes that SSL handshake error.

1 Like

Hey thanks for the code, works great. Have you tried DallE yet?

Actually I got it to work with Dall.E let me know if you want the code to add to github . Also all of this works fine on Lucee.