{"id":654,"date":"2023-11-16T01:07:23","date_gmt":"2023-11-15T14:07:23","guid":{"rendered":"https:\/\/www.samontab.com\/web\/?p=654"},"modified":"2023-11-16T01:07:25","modified_gmt":"2023-11-15T14:07:25","slug":"enhancing-customer-service-with-real-time-sentiment-analysis-leveraging-llms-and-openvino-for-instant-emotional-insights","status":"publish","type":"post","link":"https:\/\/www.samontab.com\/web\/2023\/11\/enhancing-customer-service-with-real-time-sentiment-analysis-leveraging-llms-and-openvino-for-instant-emotional-insights\/","title":{"rendered":"Enhancing Customer Service with Real-Time Sentiment Analysis: Leveraging LLMs and OpenVINO for Instant Emotional Insights"},"content":{"rendered":"\n<p>Large language models (LLMs), with their sophisticated natural language understanding capabilities, have significantly enhanced the functionality of chatbots, enabling them to conduct more meaningful and contextually relevant conversations with customers. These advanced chatbots can manage a wide range of customer service tasks, from answering FAQs to providing personalised recommendations, thus improving efficiency and scalability in customer service operations.<\/p>\n\n\n\n<p>However, despite the advancements, a critical component of human interaction often missing in digital customer service is the nuanced understanding of the customer&#8217;s emotional state. Real-time sentiment  analysis seeks to bridge this gap. By detecting subtle cues in text that indicate a customer\u2019s mood or emotional state, businesses can provide more empathetic and tailored responses. This not only helps in resolving issues more effectively but also aids in building stronger customer relationships.<\/p>\n\n\n\n<p>The integration of LLMs with sentiment analysis models, further optimised by OpenVINO, addresses this need. OpenVINO toolkit accelerates the inference process of AI models, allowing the sentiment analysis to occur instantaneously as the conversation unfolds. This enables a company to automate nuanced responses or escalate issues to live agents, depending on the emotional tone detected in customer   communications. This not only streamlines the response process but also ensures that customers with pressing or sensitive issues receive the human attention they require.<\/p>\n\n\n\n<p>Here is an example of the chatbot with a <strong>positive<\/strong> sentiment, that is, the user sentiment is close to <strong>1.0<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-dominant-color=\"f2f4f8\" data-has-transparency=\"false\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"896\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/positive-1-1024x896.png\" alt=\"\" class=\"wp-image-663 not-transparent\" style=\"--dominant-color: #f2f4f8; width:840px;height:auto\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/positive-1-1024x896.png 1024w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/positive-1-300x263.png 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/positive-1-768x672.png 768w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/positive-1.png 1393w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>On the other hand, the following is an example of a <strong>negative<\/strong> sentiment, that is, the user sentiment is close to <strong>-1.0<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-dominant-color=\"f0f2f6\" data-has-transparency=\"false\" style=\"--dominant-color: #f0f2f6;\" loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"1024\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2-1019x1024.png\" alt=\"\" class=\"wp-image-664 not-transparent\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2-1019x1024.png 1019w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2-298x300.png 298w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2-150x150.png 150w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2-768x772.png 768w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/negative-2.png 1158w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/figure>\n\n\n\n<p>You can see how a company can use these opportunities to engage with their customer exactly at these times, when the relationship is being put to the test. They could for example connect the user with a human operator just when the sentiment turned negative instead of simply leaving the chatbot continue interacting with them.<\/p>\n\n\n\n<p>In this post I will show you how you can create such an application using a Large Language Model, and real time sentiment analysis, both models using OpenVINO for fast performance.<\/p>\n\n\n\n<p>The first thing you need to do is to make sure you have your system up to date, and some basic libraries installed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get upgrade\nsudo apt-get install python3-venv build-essential python3-dev git-all<\/code><\/pre>\n\n\n\n<p>We need to get the sample source code, setup a Python environment for this project, and install the requirements:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/samontab\/llm_sentiment.git\ncd llm_sentiment\npython3 -m venv llm_sentiment\nsource llm_sentiment\/bin\/activate\npython -m pip install --upgrade pip\npip install -r requirements.txt<\/code><\/pre>\n\n\n\n<p>We are now ready to have a look at the code. Start a <a href=\"https:\/\/jupyter.org\/\">jupyter lab<\/a> with the llm_sentiment notebook, which is available at the current folder. You can do that by simply executing this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jupyter lab llm_sentiment.ipynb<\/code><\/pre>\n\n\n\n<p>Now you should be able to see the code in your browser. If you click on the fast forward button on the top right, you will be able to execute all the code. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-dominant-color=\"e2e5e4\" data-has-transparency=\"true\" style=\"--dominant-color: #e2e5e4;\" loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"142\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/fast_forward.png\" alt=\"\" class=\"wp-image-655 has-transparency\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/fast_forward.png 776w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/fast_forward-300x55.png 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/fast_forward-768x141.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/figure>\n\n\n\n<p>After clicking that button, there will be a popup asking you to restart the kernel. Click on Restart and wait for a few minutes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-dominant-color=\"f5f0f0\" data-has-transparency=\"false\" style=\"--dominant-color: #f5f0f0;\" loading=\"lazy\" decoding=\"async\" width=\"997\" height=\"329\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/kernel.png\" alt=\"\" class=\"wp-image-660 not-transparent\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/kernel.png 997w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/kernel-300x99.png 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/kernel-768x253.png 768w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/figure>\n\n\n\n<p>You will be able to access the chat interface at the end of the notebook either directly there, or in another tab by clicking on the link after this text:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-dominant-color=\"dbe0e7\" data-has-transparency=\"true\" style=\"--dominant-color: #dbe0e7;\" loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"29\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/url.png\" alt=\"\" class=\"wp-image-656 has-transparency\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/url.png 704w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/url-300x12.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-dominant-color=\"fdfefe\" data-has-transparency=\"false\" style=\"--dominant-color: #fdfefe;\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"674\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-1024x674.png\" alt=\"\" class=\"wp-image-661 not-transparent\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-1024x674.png 1024w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-300x197.png 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-768x505.png 768w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-1536x1011.png 1536w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/chat-2048x1347.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now you can test it for yourself.<\/p>\n\n\n\n<p>To get more details about the code, make sure to checkout the llm_sentiment notebook included in the repository:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-dominant-color=\"f2f2f3\" data-has-transparency=\"false\" style=\"--dominant-color: #f2f2f3;\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"563\" src=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-1024x563.png\" alt=\"\" class=\"wp-image-662 not-transparent\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-1024x563.png 1024w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-300x165.png 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-768x423.png 768w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-1536x845.png 1536w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2023\/11\/notebook-2048x1127.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can have a look at the code at <a href=\"https:\/\/github.com\/samontab\/llm_sentiment\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/samontab\/llm_sentiment<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Large language models (LLMs), with their sophisticated natural language understanding capabilities, have significantly enhanced the functionality of chatbots, enabling them to conduct more meaningful and contextually relevant conversations with customers. These advanced chatbots can manage a wide range of customer service tasks, from answering FAQs to providing personalised recommendations, thus improving efficiency and scalability in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[95,93,25,94],"class_list":["post-654","post","type-post","status-publish","format-standard","hentry","category-openvino","tag-analysis","tag-llm","tag-openvino","tag-sentiment"],"_links":{"self":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/comments?post=654"}],"version-history":[{"count":0,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/654\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/media?parent=654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/categories?post=654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/tags?post=654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}