Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Friday, April 26, 2024

Revolutionizing Onsite Search: The Power of Generative AI | Generative Answering

 In this post, we will explore how Generative AI is transforming on-site search capabilities, enhancing user experiences, and streamlining access to information. We’ll also delve into some of the challenges that come with integrating this advanced technology into existing systems.

Introduction to Onsite Search

Onsite search refers to the functionality on websites that allows users to enter search queries and retrieve information or products within that particular website. This tool is crucial for enhancing user experience, especially on e-commerce platforms where finding products quickly and efficiently can significantly impact customer satisfaction and conversion rates. Effective onsite search can mimic the ease and precision of in-person shopping experiences by quickly guiding users to their desired products or information.

However, traditional search functionalities often face challenges such as dealing with synonyms, spelling errors, and understanding the intent behind a user’s query. These limitations can lead to irrelevant search results, a frustrating user experience, and potentially lost sales. Moreover, traditional searches might struggle with indexing and retrieving content in a way that aligns with how users think and search.

For a deeper dive into enhancing onsite search, see my previous articles Onsite Search: The Must-Have Features for a Seamless User Experience | by Albin Issac | Tech Learnings | Medium Selecting a Search Engine for on-site Search — Open Source vs Search as a Service | by Albin Issac | Medium

Overview of Generative AI

Generative AI refers to a subset of artificial intelligence technologies that can generate new content and ideas based on the data it has been trained on. This contrasts with other forms of AI that typically focus on classifying or predicting outcomes based on input data. Generative AI involves advanced machine learning techniques, including natural language processing (NLP) and neural networks, to produce outputs that are not explicitly programmed into the system.

Technologies behind generative AI, such as NLP, enable the AI to understand, interpret, and manipulate human language. Neural networks, particularly deep learning models, allow the AI to process large amounts of data, recognize patterns, and make decisions with minimal human intervention. These capabilities make generative AI particularly valuable for enhancing onsite search because it can understand and interpret the complexities and nuances of human language, predict what users are searching for even with vague or incomplete queries, and generate relevant results even from sparse data inputs.

By leveraging generative AI, websites can overcome many of the traditional challenges associated with onsite search, leading to a more intuitive and satisfying user experience. This is particularly beneficial in e-commerce settings, where the ability to quickly and accurately display products based on user queries can directly influence buying decisions and overall business success.

Search engines have long utilized AI technologies to enhance user experience and deliver more relevant content. Here are several AI-driven features that have been key in revolutionizing search functionalities:

  • Smart Snippets: Provide concise previews of content relevant to search queries, offering users quick insights into the content’s relevance without having to click through to the page.
  • Automatic Relevance Tuning (ART): This leverages user interaction data to dynamically adjust and refine the relevance of search results, ensuring that users find the most pertinent information based on collective user behaviors.
  • Query Suggestions: By analyzing aggregated search data, this feature suggests related queries in real-time as users type, helping them formulate more effective searches and discover content more efficiently.
  • Content Recommendations: Utilizing user behavior, previous search histories, and browsing patterns, AI suggests additional relevant content, potentially increasing engagement and time spent on a site.
  • Dynamic Navigation Experience: AI algorithms optimize and personalize navigation interfaces based on common user journeys and behaviors, making site navigation more intuitive and user-friendly.
  • Image and Video Recognition: Advanced visual recognition technologies enable search engines to index and retrieve images and videos based not just on metadata but on the visual content itself, enhancing the search capabilities for multimedia.
  • Document Search: AI enhances the ability to search within documents by recognizing and indexing text from various document formats. This technology enables users to perform deep content searches, finding specific information within large documents or across a collection of documents. AI-driven features like optical character recognition (OCR) and natural language understanding (NLU) are often employed to interpret the content accurately and return relevant results based on the content’s context rather than just keyword matches.
  • Sentiment Analysis: Employed by some search engines, this feature analyzes the emotional tone of content, useful for businesses monitoring brand reputation or media sites gauging public sentiment.
  • Personalization Engines: These tailor search results and content displays to individual users based on their unique preferences and past interactions, creating a more personalized and relevant browsing experience.

Generative Answering with AI in Search

Generative AI is transforming the landscape of search technology by introducing the advanced capability of generative answering. This innovative approach transcends the conventional mechanisms of search that primarily focus on retrieving data. Instead, it involves the understanding and generation of responses that directly address a user’s queries.

What is Generative Answering?

Generative answering is the capability of AI systems to construct responses from scratch, based on the extensive data they have been trained on. Utilizing models such as GPT (Generative Pre-trained Transformer) and BERT (Bidirectional Encoder Representations from Transformers), this technology grasps queries in a detailed and nuanced manner, delivering precise, context-aware answers.

Image from Coveo

Key Benefits of Generative Answering in Search

  • Direct Answers: Moving beyond traditional search engines that list documents or links, generative answering provides a direct and succinct response to queries, synthesizing information from multiple sources or extrapolating from existing data.
  • Natural Language Interaction: This capability fosters a more conversational interaction, allowing users to engage with the AI in a dialogue format where the system understands and responds to follow-up questions or requests for clarification.
  • Personalized Responses: The AI customizes responses based on individual user history or preferences, greatly enhancing the relevance and personalization of the search experience.
  • Efficiency in Information Discovery: By quickly delivering the specific information users seek, generative answering significantly reduces the time spent navigating through irrelevant results.

Expanded Applications of Generative AI in Onsite Search

  • Customer Support: Provides immediate, accurate answers to customer inquiries, streamlining customer service operations without the need for extensive human intervention.
  • E-commerce: Enhances product discovery and customer shopping experience by offering detailed product information and tailored recommendations directly in response to user queries.
  • Education: Supports an interactive learning environment by instantly responding to student queries with detailed explanations, promoting a more engaging educational experience.
  • Content-Based Sites: Significantly improves search and discovery on content-rich platforms such as news sites, blogs, and digital libraries. Generative AI can swiftly analyze large datasets, enabling it to deliver precise answers, recommend related content, and generate content summaries that aid users in efficiently navigating and consuming information.
  • AI-Powered Chatbots: These sophisticated chatbots utilize indexed data to conduct meaningful conversations, providing support and information directly through interactive dialogues.
  • Content Creation and Augmentation: AI not only helps in creating new content that aligns with current trends and user interests but also optimizes existing content to enhance its discoverability and engagement.

Generative answering, along with these applications, illustrates the profound impact Generative AI has on enhancing the functionality and user experience of search systems. As this technology continues to evolve, its integration into search platforms is expected to redefine the norms of how information is queried and retrieved, making searches more intuitive, interactive, and effective.

Most of search engines now support Generative AI capabilities to enable Generative Answering and chatbots, the search engines already have customer data indexed through a traditional approach but now the search engines started supporting the Retrieval Augmented Generation approach to enable generative AI capabilities. The content indexing and retrieval process is enabled with additional steps to support Generative Answering.

High-Level Steps in Indexing and Retrieval to Support Generative Answering:

1. Document Indexing and Embedding Generation: Before any search queries are processed, documents must be indexed. As part of this indexing process, each document is processed to generate embeddings. These embeddings, which are dense vector representations of the document’s content, capture the semantic essence of the text. Using AI models such as BERT or GPT, the search engine converts the text of each document into these embeddings and stores them in the search index. This allows for efficient retrieval based on semantic similarity rather than mere keyword matching.

2. Query Reception and Preprocessing: When a query is received, the first step is preprocessing. This involves normalizing the text by converting it to lowercase, removing punctuation, and correcting any typos. Such preprocessing simplifies the text to ensure more effective subsequent analysis.

3. Query Embedding Generation: The preprocessed query is then converted into an embedding using the same AI models used during document indexing. This ensures that the query can be semantically compared to the indexed documents.

4. Chunking and Contextual Analysis: If the query is complex or contains multiple elements, it is broken down into smaller chunks. This chunking isolates specific aspects of the query for more targeted processing. Contextual analysis is also performed, considering previously indexed information, user’s search history, or the specific session context.

5. Retrieval from Index: The query embedding is used to retrieve the most relevant documents from the search index. This is done using similarity metrics that compare the query’s embedding with the embeddings of documents stored in the index, ensuring the retrieval of content that matches the semantic intent of the query.

6. Generate Prompting: After relevant information is retrieved, the search engine constructs a detailed prompt for the generative model. This prompt includes the query, relevant context from the retrieved documents, and additional pertinent information that can guide the AI in generating an accurate response.

7. Send Prompt to Generative Model: This prompt is sent to a generative AI model, such as GPT-3 or GPT-4, which uses it to generate a response that directly answers the user’s query. The generative model synthesizes the information, producing coherent, context-aware text.

8. Answer Generation and Post-Processing: The generated answer undergoes post-processing to ensure it meets quality standards, refining it for clarity and appropriateness. If necessary, the prompt may be adjusted and the generation process rerun.

9. Delivery to User: The refined answer is then delivered to the user through an interface that may allow further interactions, such as query refinement, follow-up questions, or feedback. This feedback is crucial for continuous learning and system improvement.

The integration of Generative AI into search engines represents a paradigm shift away from traditional keyword-centric approaches towards more dynamic, context-sensitive systems. This advancement enriches the search experience, providing users with direct answers, engaging conversations, and tailored content, thereby refining the information discovery process.

Most onsite search engines have now adopted Generative AI capabilities. The advantage here is that since data has already been indexed using traditional methods, implementing Generative AI is relatively straightforward, avoiding the need for extensive content reprocessing and the setup of Retrieval Augmented Generation (RAG) workflows. Furthermore, these search engines offer APIs that facilitate the retrieval of data for both traditional search results and generative answering, making it possible to display information through various interfaces like search pages, chatbots, and more.

A concern with this approach, however, is that many search engine systems offer limited flexibility in selecting embedding models, configuring chunking, or choosing the GPT model. They often rely on predefined proprietary or open-source models, configurations, and prompts. This can be problematic for those who require more control over data processing and the customization of prompts and models.

The capacity for Generative AI to deliver quick and direct answers to customers is an impressive feature that significantly enhances user interaction. Looking forward, there is an anticipation that search engines will begin to provide greater flexibility and options to meet custom requirements for generative answering, catering to a wider range of use cases and further innovating the field of search.

Refer to About Relevance Generative Answering (RGA) | Coveo Machine Learning for understanding how Coveo supports Generative Answering

Saturday, January 6, 2024

Amazon Q: Generative AI Assistant- Connect to Websites and AEM CMS Data

 Amazon Q is a generative artificial intelligence (AI) powered assistant, designed for work and tailored to your business needs. With Amazon Q, you can engage in conversations, solve problems, generate content, gain insights, and take action by connecting to your company’s information repositories, code, data, and enterprise systems.

You can develop a chat application that connects to various company-specific data sources and websites, enabling it to perform a range of operations such as providing relevant answers, generating content, summarizing information, and more.

Amazon Q is currently in preview. For more details on Amazon Q, please refer to the official announcement at AWS Blog: Introducing Amazon Q — A New Generative AI-Powered Assistant (Preview).

In this blog, we will explore how to integrate Amazon Q with websites and the AEM CMS system, enabling various generative capabilities tailored to specific content.

Amazon Q supports various data sources including Amazon S3, Web Crawlers, Uploaded Files, GitHub, Gmail, Microsoft Teams, SharePoint, Slack, and more.

Access to the Amazon Q preview is available through https://us-east-1.console.aws.amazon.com/amazonq/home?region=us-east-1#welcome

As a first step create a Amazon Q application — Enter a application name, Create New Service Role or you can use the existing service role.

Select the retriever: Choose the ‘Native Retriever’ to index the source content directly. If you are already using Amazon Kendra Search, use the ‘Existing Retriever’. In our case, select ‘Native’ as we are directly going to index content from a website and AEM content natively.

Now you can select the datasource, first select web crawler

Enter a name for the data source and select the source type. You have the option to provide direct URLs or a Sitemap. I am opting for a Sitemap, and you can add up to 3 sitemaps if necessary.

You can add various additional configurations if required

Web Proxy and Authentication.

Sync Scope

Additional Scope Seetings — Modify the values if required

Control the URL Patterns for the Crawl and Index.

Sync Mode

For the demo, I am using the ‘Run on Demand’ feature for the Sync Run Schedule. Additionally, custom scheduler expressions can be set up using the ‘Custom’ option.

Once the data source is created, you have the option to synchronize it immediately by selecting ‘Sync Now’. This action initiates the crawling and indexing processes.

You now have the ability to preview and tailor the chat box experience according to your specific needs.

Once the indexing is complete, you can begin interacting with the assistant using prompts.

You should be able to locate sources based on the responses generated.

You also have the option to upload a limited number of additional files specific to this chat session, enabling you to execute a variety of prompts based on your website content.

Additionally, you can incorporate optional enhancements into the application, including admin controls and guardrails, plugins, and document enrichments.

The following plugins are available, each designed to perform specific actions

Let’s proceed to create an additional data source. This will connect to the AEM Author for indexing content and assets. Begin by adding a new datasource and then selecting ‘Adobe Experience Manager’.

You can connect to either AEM as a Cloud Service or to AEM On-Premise Author servers. For this demonstration, I am connecting to an on-premise server. If you choose to connect with an On-Premise server, you will need to download the public SSL certificate of the AEM author domain and upload it to an S3 bucket. In my case, I am using an ngrok domain to access the AEM server, and the public certificate can be directly exported from the browser.

Authorization

If authorization is enabled, you will have the option to enable or disable the Identity Crawler setting. Once the Identity Crawler is active, Amazon Q leverages the crawled ACL information to generate chat responses for your end users. Importantly, these responses are tailored based on the documents the user has access to; the chatbot responds to prompts solely in the context of the documents available to the user.

Basic authentication or OAuth can be utilized. For using OAuth authentication (Technical Account) with AEM as a Cloud Service, please refer to Adobe’s guide on generating access tokens for server-side APIs. It is essential that the user possesses administrator access. Additionally, you will need to create a new secret in AWS Secrets Manager to configure the details for basic or OAuth authentication. The configuration details will vary depending on the selected authentication method.

You can define the sync scope as shown in the below diagram

The crawling process can be limited to specific page component names

Additionally, you have the option to target specific content fragment variations, as indicated in the below diagram

For the demonstration, I am restricting the crawling to a specific content root path, limiting it to ‘/content/we-retail/us/en’.

You can also establish include or exclude regex patterns.

Some of the remaining configurations are similar to those used in a web crawler. Once the data source is created, you can proceed with syncing the content.

Once the crawling and indexing processes are completed, you can begin interacting with the content through prompts.

Sample Prompt: ‘Provide a summary of Arctic Surfing in Lofoten.’ Following this prompt, a concise summary will be displayed, accompanied by a source reference to the AEM page.

Once the application is built and tested, it can be deployed, and the URL can be shared with the teams.

When deploying the application, you need to configure the identity provider to support SAML authentication.

Enable the SAML configuration in your Identity Provider (IDP) using the provided details and upload the corresponding metadata file.

Configure the email and group (optional) attributes of the SAML assertion.

Once the deployment is completed, you can access the chatbox URL and share it with your teams. To access the chatbox, you must authenticate with your Identity Provider (IDP).

For demonstration purposes, I have created two users in Adobe Experience Manager (AEM) with valid email addresses. These same users have been enabled in the IDP. However, one of these users does not have access to the ‘/content/we-retail/us/en’ directory(you need to resync for any permission or content changes).

When the user logs into the chatbox using an email that has access to specific content, the chatbox will respond with the required details.

Prompt — “Provide summary on Arctic Surfing in Lofoten”

“When the user logs into the chatbox using an email that does not have access to the specific content, the chatbox will not provide a response.

Prompt — “Provide summary on Arctic Surfing in Lofoten”

In conclusion, Amazon Q represents a significant advancement in the realm of Generative AI Assistants, offering seamless integration with different sources including websites and Adobe Experience Manager (AEM) CMS data. By enabling authorization and configuring the Identity Provider for SAML authentication, users can unlock personalized and secure interactions based on the user’s access rights.