Skip to main content

Chat with your product catalog with AI

Time to complete: 30-45 minutes.

By following this guide you will learn how to use openAI to build an Q&A bot that can answer questions about your product catalog. This is useful if you want to automate admin tasks like categorizing products, enriching your product catalog with product attributes, automatically generate product titles and descriptions, translate your product catalog to multiple languages, easely build content from your product catalog and much more.

Pre-requisites

Steps

Clone template repository from GitHub

Hit the ground running by cloning the template repository from GitHub. The template repository includes all the files you need to get started.

git clone https://github.com/geins-io/guide-product-chat.git

Install dependencies

pip install -r requirements.txt

Add your OpenAI API key

Get an OpenAI API key from the OpenAI dashboard. Use the the key to set the OPENAI_API_KEY environment variable.

...
os.environ["OPENAI_API_KEY"] = 'sk-YOUR_OPENAI_API_KEY'
...

Add your Geins API key

...
os.environ["GEINS_API_KEY"] = 'YOUR_GEINS_API_KEY'
...

Select your AI model

OpenAI offers a wide range of AI models. For this guide we will use the gpt-3.5-turbo model. You can select the model you want to use by changing the model_name parameter in the OpenAI class. You can also change the temperature parameter to adjust the AI model's creativity. The higher the temperature the more creative the AI model will be.

...
llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.7, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
...

Run the app

python app.py

On macOS and Linux, you may need to use python3 instead of python.

Open the URL that is printed in the terminal. It will look something like this: https://12345.gradio.app. You can also click on the link in the terminal. Since share is True gradio will create a public URL for you to share.

Try it out! Ask questions about your product catalog

Try asking questions about your product catalog. For example, you can ask questions like:

Q: Describe SKU-1005-01 in a short blog post, please.
A: Experience the future of virtual reality with SKU-1005-01! This state-of-the-art VR headset from Brand 01 offers precision room-scale tracking and 5K fidelity for stunning visuals. With its ergonomic design, you can enjoy extended use in comfort and balance. Step into a world of limitless possibilities with SKU-1005-01 and order now!

Q: What is the price of SKU-1005-01?
A: SKU-1005-01 is available for $499.99.

Q: Is SKU-1005-01 cordless?
A: No, SKU-1005-01 is not cordless. According to the parameter group for the VR Headset, the value for Cordless is "No"

Next steps

Now that you have a working Q&A bot, you can start using it to automate admin tasks. For example, you can use it to automatically generate product titles and descriptions, translate your product catalog to multiple languages, easely build content from your product catalog and much more.

If you want to learn more about the different AI models OpenAI offers, check out the OpenAI model cards.

Use Management API to input answers and automate admin tasks. For example, you can use it to automatically generate product titles and descriptions, translate your product catalog to multiple languages, easely build content from your product catalog and much more.

Add more information to the product catalog context

Add pdf files containing product data in the docs folder to add more information to the product catalog context.