Metadata-Version: 2.4
Name: syn_data_csv
Version: 0.2.1
Summary: Synthetic data generation using LLMs
Author-email: Shyam Kota <shyamsundar.kota@infoservices.com>
Maintainer-email: Shyam Kota <shyamsundar.kota@infoservices.com>
License: MIT License
        
        Copyright (c) 2025 Shyam K
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights  
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
        copies of the Software, and to permit persons to whom the Software is  
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in  
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
        THE SOFTWARE.
Project-URL: Homepage, https://github.com/Shyamkotainfo/Syn_data_gen/tree/shyam/syn_data_csv
Project-URL: Documentation, https://github.com/Shyamkotainfo/Syn_data_gen/blob/shyam/syn_data_csv/README.md
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: groq>=0.25.0
Requires-Dist: pandas>=2.2.3
Requires-Dist: python-dotenv>=1.1.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: requests>=2.32.4
Requires-Dist: tqdm>=4.66.4
Requires-Dist: huggingface_hub>=0.23.0
Provides-Extra: dev
Requires-Dist: twine; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# Synthetic Data Generation PoC

## Overview
This project generates synthetic data using an AI model based on a given YAML configuration file and a reference CSV file. The generated data follows the provided column structure and user-defined constraints.

## Features
- Reads column definitions and user instructions from a YAML configuration file.
- Validates the structure of the YAML file.
- Validates the format of the reference CSV file.
- Generates synthetic data using Groq's Mixtral model.
- Ensures the output is in CSV format without headers or extra text.
- Enforces unique rows with consistent column counts.

## Prerequisites
- Python 3.8+
- Required Python packages:
  - `yaml`
  - `pandas`
  - `json`
  - `csv`
  - `groq`

<!-- ## Installation
1. Clone the repository or copy the script to your local environment.
2. Install dependencies using pip:
   ```sh
   pip install pandas pyyaml groq
   ```
3. Obtain a Groq API key and replace `api_key` in the script with your key. -->

## Usage
Run the script with the required YAML configuration file and reference CSV file:
```sh
python test1.py config.yaml test_data.csv [optional_api_key]
```

## Arguments

config.yaml - YAML file specifying column definitions and generation rules.
test_data.csv - Reference CSV file to guide synthetic data generation.
[optional_api_key] - (Optional) Your own Groq API key. If not provided, a default API key will be used.



### YAML Configuration Structure
The YAML file should define columns and the prompt:
```yaml
columns:
  - name: "id"
    type: "integer"
  - name: "name"
    type: "string"
  - name: "email"
    type: "string"
  - name: "age"
    type: "integer"
  - name: "city"
    type: "string"
  - name: "signup_date"
    type: "datetime"
    
num_rows: 100
prompt: "Generate a dataset for user profiles."
```


## Reference CSV File (`test_data.csv`)
This file provides sample data for reference.

### Example `test_data.csv`:
```csv
id,name,age,email,city,signup_date
101,John Doe,28,john.doe@example.com,New York,2023-05-14
102,Jane Smith,34,jane.smith@example.com,Los Angeles,2022-11-21
...
```

## Expected Output
- The generated dataset will be stored in `synthetic_data.csv`.
- The output will contain only comma-separated values without extra text or headers.
- The generated rows will be unique and follow the reference data pattern.

## Error Handling
- If the YAML configuration is invalid, the script will display an error message and exit.
- If the reference CSV file has missing columns, the script will halt with an error.
- If no valid data is generated, an appropriate message will be displayed.

## License
This project is for demonstration purposes only. Usage is subject to Groq API policies.

