Chat messaging may have become an indispensable part of our daily interactions, but advancements in AI technology promises to make it even smarter. We are thrilled to introduce the latest AI enhancement to Q-Consultation Lite, our open-source chat and video calling app–-AI Answer Assist. Our exciting new feature enables businesses to deliver fast and accurate responses to customer inquiries in real-time, promoting a whole new level of convenience and productivity in chat messaging. Let’s delve into the benefits of AI-powered video communication and explore how OpenAI chat completions have made it all possible.
Learn more about, Q-Consultation Lite! Free, Open Source Software
We’ve all experienced the frustration of pausing mid-conversation to search for answers to questions or to clarify information. We also know how time-consuming and tedious it can be to repeat the same information to different customers over and over again.
With the introduction of AI Answer Assist, those days of interruption and monotonous tasks are over. Answer Assist is capable of providing instant, accurate, and contextually relevant responses to a wide range of queries, making chat messaging smarter and more productive than ever before.
Whether our AI-driven video call solution is being used by a doctor, sales manager, or customer support agent, its embedded Answer Assist provides support during a live chat to generate instant and accurate responses to a wide range of questions.
Learn more about, Meet Q-Consultation: Solution for Virtual Meetings and Queue Optimization
Whatever the use case, the Answer Assist provides a host of benefits enabling service providers to respond quickly and accurately to inquiries and messages from clients, reducing response time, and increasing customer satisfaction. Other benefits include:
Learn more about, Make a Virtual Meeting Room Application with Q-Consultation
Our AI-enhanced video conferencing solution leverages the cutting-edge technology of OpenAI, which created ChatGPT, a powerful large language model that can automatically generate text based on training data. OpenAI offers various tools for text generation, including Chat Completions which is specifically designed for chat-like interfaces. Chat completions provide accurate and contextually relevant responses in real-time. Chat completions, powered by advanced deep learning algorithms, enable the Q-Consultation’s Answer Assist to access a vast pool of knowledge and comprehend natural language, just like a human.
Here’s a breakdown of how it works:
The integration of OpenAI GPT into the Q-Consultation application is a relatively straightforward process. In the following we provide a brief overview of the key steps needed to help you successfully implement the AI Assist feature into your application’s interface. We will also provide a guide on optimization so that you can improve the quality of responses generated by Answer Assist to ensure more precise and relevant outcomes.
OpenAI’s tools can be utilized through REST APIs or libraries for various programming languages. For our application the first step was to install the OpenAI Node.js Library. This library provides convenient access to the OpenAI API from Node.js applications.
The library needs to be configured with the secret key of your OpenAI account, which is available on your OpenAI account page.
In Q-Consultation Lite, we have already set everything up, so that you can simply add the API key (OPENAI_API_KEY) to the application’s config (qconsultation_config/.env).
To create the AI Answer Assist functionality we utilized OpenAI Chat Completions and developed a function that generates a response to a single input question.
import { ChatCompletionRequestMessage } from 'openai' import { openAIApi } from '@/services/openai' export const createQuickAnswer = async (question: string) => { const messages: ChatCompletionRequestMessage[] = [ { role: 'system', content: 'You are consulting the user.' }, { role: 'user', content: question }, ] const { data } = await openAIApi.createChatCompletion({ messages, model: 'gpt-3.5-turbo', temperature: 0.5, }) return data.choices[0]?.message?.content }
In this code, we used the gpt-3.5-turbo model, one of the most advanced and powerful models offered by OpenAI, providing a good balance between text generation quality and speed. It can generate readable and coherent responses with a high level of probability. If you want to further improve text generation, you can use the gpt-4 model. You can also try other models, but before doing so, make sure to review the pricing for their usage.
Additionally, we used the “temperature” parameter, which controls the degree of randomness in generating responses. The value of 0.5 used in this code is a moderate value, striking a balance between randomness and conservative text generation. The generated responses will have some variability, helping to avoid overly predictable or dull answers, while still being meaningful and contextually appropriate.
After testing this function in dialogues, we realized that it did not provide sufficiently high-quality results, so we decided to provide OpenAI GPT with the context of the conversation. Therefore, we added all the messages from the dialogue to help it quickly deliver a more relevant response. Additionally, we included the service provider’s profession and the dialogue topic to increase the accuracy of the generated responses.
import { ChatCompletionRequestMessage } from 'openai' import { openAIApi } from '@/services/openai' export const createQuickAnswerForDialog = async ( profession: string, dialogTopic: string, dialogMessages: ChatCompletionRequestMessage[], ) => { const messages: ChatCompletionRequestMessage[] = [ { role: 'system', content: `You are a specialist ${profession}. You are consulting the client. You were approached with an issue: "${dialogTopic}".`, }, ...dialogMessages, ] const { data } = await openAIApi.createChatCompletion({ messages, model: 'gpt-3.5-turbo', temperature: 0.5, }) return data.choices[0]?.message?.content }
During the implementation of this functionality, we identified the following optimization techniques to enhance the quality of answers provided by Answer Assist:
The integration of OpenAI GPT into the Q-Consultation application with the Answer Assist feature opens up new possibilities for enhancing communication between businesses and their customers.
Q-Consultation, built with the robust QuickBlox video SDK, and has now reached new heights in terms of efficiency, productivity, and user satisfaction. By harnessing the power of OpenAI chat completions, we have enabled a smarter, more dynamic chat experience that will undoubtedly reshape the way we communicate.
Don’t forget that we offer Q-Consultation Lite as open source software, so you can enjoy a free open source AI Assistant right at your fingertips! Happy chatting!
Read the OpenAI API Reference
Learn more about Q-Consultation in our blog.
Check out the Q-Consultation documentation.
Visit our Q-Consultation repository.