Synthetic Product Data Generator
Tags: python, llm, langchain, ai
Published: 2024-03-24 18:49:12

---
title: Synthetic Product Data Generator
published: true
canonical_url: https://asanchez.dev/blog/synthetic-product-data-generator/
description: "A Jupyter Notebook for synthetic product data generation using Large Language Models (LLMs) through the LangChain framework."
tags: 
  - Python
  - LLM
  - LangChain
  - AI
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-03-24 18:47 +0000
---
Today, I'm sharing a new project: a [Jupyter Notebook for synthetic product data generation](https://github.com/antsanchez/synthetic-product-data-generator) using Large Language Models (LLMs) through the [LangChain framework](https://python.langchain.com/docs/get_started/introduction). This tool is designed to aid in the creation of synthetic yet realistic product listings for e-commerce and other domains.

## What It Does
The notebook facilitates the generation of synthetic data, including vendor names, product categories, and detailed product information such as titles, descriptions, and prices. It is built with flexibility in mind, allowing for the integration of different LLMs and customization of data generation parameters to suit various needs.

Features:

- Integration with multiple LLMs, including examples for Ollama and OpenAI.
- Customizable data generation to adjust shop type, categories, vendors, and product details.
- Interactive environment for real-time monitoring and adjustments.

## Why I Started This Project
I started working on this project because I'm really interested in a few key areas:

### Exploration of LangChain
The main reason I began this project was to gain more hands-on experience with the LangChain framework. I was curious to see not only how it operates but what possibilities it unlocks when integrated with various LLMs. 

### Prompt Engineering
Another important part of this project is learning how to make good prompts. Figuring out the right way to ask questions or give commands to LLMs can really change the results you get. This project is like a testing ground where I try out different kinds of prompts to see how small changes can make a big difference in what kind of information or data we can generate.

I quickly found out the trickiest part was getting the prompts just right. It’s amazing how a single word change can totally switch up the results, especially with the smaller LLMs. This part of the project was where I spent most of my time, going through many iterations to get it perfect

### Creating Synthetic Data
A big part of why I'm doing this is to have a tool that lets me easily create customized synthetic data for some others of machine learning and retrieval-augmented generation (RAG) projects I'm working on. Having the ability to produce realistic yet artificial data means I can test, develop, and analyze different projects more effectively. 

## Crafting My Own Tools
So, why didn't I just use some tool that's already out there? Because building my own would is more fun and a great way to practics. Plus, I wanted something that fit exactly what I needed, which I couldn't really find with the tools available. 

This notebook is a practical tool that embodies these motivations. It demonstrates the power of combining custom prompts with different LLMs to produce synthetic data that is not only diverse but also closely tailored to specific project requirements.

## Getting Started
For those interested in using or contributing to this project, the notebook is available on my GitHub repository. Installation instructions and details on how to customize and run the notebook are provided in the README. The project also supports running in Google Colab for ease of access and use.

Dependencies can be installed via pip, and the project is ready to run in a local environment or in Google Colab with minimal setup.

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/antsanchez/synthetic-product-data-generator/blob/main/Generator.ipynb)

## Join the Effort
I welcome contributions and ideas to enhance this tool. Whether you have suggestions for new features or improvements, feel free to reach out through GitHub.