Imagine having a virtual perfume assistant, instead of sniffing a lot of concoctions. Well, I played around with OpenAI API and used perfume data that I had scraped for my simple recommender system,which you can find here. It may not be perfume shazam, but it's a great place to start!
An AI perfume recommendation assistant. Allow me use an analogy, you have a shop, well stocked, you have a shop assistant. You should be able to sell right? Right. Well customer service is crucial too. In this project, the stock is the perfume data, the shop assistant is the OpenAI model and the customer service are the instructions we give the model.
- Python 3.11.1 - a popular programming language
- Jupyter Notebook - a server-client application that allows editing and running notebook documents via a web browser
- OpenAI API - an api that allows for any task that involves understanding or generating natural language or code using the same technology chatgpt3 is based on
- PineCone - a fully managed vector database that makes it easy to add vector search to production applications.
- Load dataset
- Perform tokenization -(split paragraphs/sentences into smaller units that can be assigned meaning)
- Choose preferred model according to need and get embeddings
- Save embeddings to vector database that allows for indexing and eliminates need for constant generation
- Create context for AI
- Define function that instructs how the model should respond to queries
# clone repo
git clone https://github.com/elabongaatuo/openai-perfumeassistant.git
# change into directory
cd openai-perfumeassistant
# install the necessary packages
pip install -r requirements.txt
To access the OpenAI API, you need to create an account here
To access the PineCone Index API, you need to create your account here
You may obtain the API Keys from OpenAI but however may not get a response and get a "you exceed your current quota" error.
To solve this, you may need to add a payment method.
After adding a payment method, go ahead and create a new API Key.
You should as well be wary of the number of tokens your dataset has as each token is charged based on the model used.
You may as well encounter an error: "The server had an error while processing your request. Sorry about that!" . Not to worry, that isn't your fault, there could be many requests from other users at the time. Here are some of the suggested solutions from the community
At the time of publishing, all keys used in the notebook have been revoked.
!!! Huge File Size
- This amazing walkthrough/demo medium article.
- OpenAI types of models
- A little perfume theory - Nukato
- OpenAI Embeddings Tutorial
More information such as user feedback on perfume sillage and preference accompanied by
descriptive reviews may help in better recommendations.
- perfume-recommenderv2.ipynb - details how to go about the project
- marashi-babbage.parquet - contains perfume data in parquet form. (flat column data storage)
- marashi-mapping.json - json file that will allow for reverse mapping by index
Elabonga Atuo
Contact me via email