Integrating generative AI into e-commerce search systems can significantly enhance user experience by refining query understanding and delivering more relevant results. A practical implementation involves deploying a query expansion mechanism that utilizes AI to interpret and broaden user search inputs.
Implementation Overview
The GenAISearchQueryExpander repository provides a .NET 8.0 application designed for this purpose. It leverages Azure Functions and Azure OpenAI to expand search queries, thereby improving the retrieval of pertinent products.
Key Features
- Azure Functions Integration: Utilizes serverless computing to handle search query processing efficiently.
- AI-Powered Query Expansion: Employs Azure OpenAI to generate expanded versions of user queries, capturing a broader range of relevant search terms.
- HTTP Trigger Support: Allows the function to be invoked via HTTP requests, facilitating seamless integration with existing e-commerce platforms.
Setup and Deployment
- Prerequisites:
- .NET 8.0 SDK
- Azure Account
- Azure Functions Core Tools (for local development)
Example Usage
Once deployed, the function can be invoked via an HTTP POST request with a JSON payload containing the user's search query. The function processes this input, utilizes Azure OpenAI to generate expanded search terms, and returns the enhanced query for use in the e-commerce platform's search index.
You simply need to call the REST API and supply the search query from the user and the model name you want to use. The API will then supply the query and system prompt to the LLM and expand the query into more keywords that better meet the user’s intent.
Use Case Examples
- Fashion Retail: A customer searches for "red dress," but the AI expands this to include terms like "maroon gown," "crimson evening wear," and "burgundy cocktail dress."
- Electronics Store: A search for "gaming laptop" expands to "high-performance laptop," "RTX 4060 laptop," and "16GB RAM laptop."
- Home Improvement: A query for "LED light bulbs" expands to include "energy-efficient bulbs," "smart LED bulbs," and "dimmable LED lights."
- Grocery Delivery: A search for "organic apples" is expanded to include "fresh Fuji apples," "organic Granny Smith apples," and "pesticide-free apples."
This can also enable brand new experiences for users. Instead of searching for keywords, they can type in the problem they are trying to solve. For example:
- “I am painting my kid’s bedroom” could return paints, brushes, rollers, handles, tape, drop clothes.
- “What do I need for a football party?” could return all kinds of snacks, decorations, electronics, or clothing.
By understanding the intent of what the user is looking for, this solution can provide more relevant results and suggest products the user hadn’t even thought about yet.
By implementing this AI-driven query expansion, e-commerce platforms can significantly improve search accuracy, leading to enhanced user satisfaction and potentially increased sales.