This code repo demonstrates how to use the word embedding model from Azure OpenAI Service to perform a semantic search on a grocery store dataset. The dataset contains 50 items with their names only. The word embedding model (text-embedding-ada-002) converts the items and the search terms into high-dimensional vectors and computes the cosine similarity between them. The cosine similarity measures how close the vectors are in terms of their orientation, which reflects their semantic similarity. The code repo shows how to use the Azure OpenAI Service to get the word embeddings, how to calculate the cosine similarity, and how to rank and display the most relevant items for a given search term.
Enjoy!