Over the last couple of weeks I’ve been working on enabling file upload using the AI Powered Chatbot for WordPress plugin I created. Yesterday, my implementation finally worked.
Well, it essentially worked. There were, however, several details to work out. What to do with the intermediate file that was uploaded to the web server. Then what to do with the file once it was loaded onto the OpenAI platform.
Details! Details I say.
Building this out wasn’t easy for me. There were many missteps along the way. I thought that I needed to guzzle the content and then send it as message to ChatGPT. Turns out that I didn’t need to do that.
Then I managed to get the file uploaded to the platform. I could see it on the OpenAI server. I had the id to the file. But I couldn’t quite figure out how to include it in the Assistant thread, that is to say, make ChatGPT aware of the file and be able to answer questions or summarize it’s content.
Along the way I created a GPT Assistant into which I loaded all the API documentation that I could download from OpenAI’s website. Then I created an Assistant to specialize in all things about the API by uploading the API documentation.
You see, asking ChatGPT 4, OpenAI’s most advanced Large Language Model (LLM) which they claim is up to date as of April 2023, returned rather generic answers to questions that I asked about the API. The GPT Assistant on the other hand, I came to learn, answer with specific and detailed answers directly about OpenAI’s API and how to use it.
So, after a few more trial and errors I had a working version of the AI Powered Chatbot for WordPress plugin where I could upload files, delete them off the local server after moving them to the OpenAI platform, incorporate them into the Assistant’s thread, and delete them off the platform shortly thereafter.
On the OpenAI platform, I created an Assistant (https://platform.openai.com/assistants) that was essentially a shell. Then I created some text which I printed to a PDF that I could use with the “Gaming Assistant” I created on the platform. I wanted to prove to myself that if used the plugin to upload a PDF with specific information about a card game I often play called Five Kings, that the Assistant, if asked, could answer specific questions using the document provided.
The screen grab below you can see one of the first questions I asked. This image shows the AI Powered Chatbot for WordPress plugin in embedded mode. The shortcode for this is:
[chatbot style=embedded assistant=asst_urc ... M1]
So, I asked the Assistant to summarize the document just uploaded. It did ok. The document wasn’t very extensive, and the results basically parroted back the contents of the PDF.
But it was successful.
So, now I have some polishing up to do to the code and I’ll be ready to release Version 1.7.9 to production shortly (probably within the next few days). The ability to upload files has been frequently asked for feature. And, I can’t wait to offer it to the community where the AI Powered Chatbot for WordPress plugin is actively installed.
I’ll look forward to getting feedback from the community as they begin to use it. Their support questions have been invaluable in creating a robust plugin.
I cannot tell you how thankful I am that they have taken time to share their valuable feedback, as it has helped me continually improve and provide a better experience for everyone using the plugin.
#Innovation #WordPressPlugin #WordPressAI
About the Author
Stephen Howell is a multifaceted expert with a wealth of experience in technology, business management, and development. He is the innovative mind behind the cutting-edge AI powered Kognetiks Chatbot for WordPress plugin. Utilizing the robust capabilities of OpenAI's API, this conversational chatbot can dramatically enhance your website's user engagement. Visit Kognetiks Chatbot for WordPress to explore how to elevate your visitors' experience, and stay connected with his latest advancements and offerings in the WordPress community.