Metadata-Version: 2.4
Name: datacreator-sdk
Version: 0.1.5
Summary: Python SDK for the DataCreator AI dataset generation API
Author-email: DataCreator AI <team@datacreatorai.com>
License: MIT
Project-URL: Homepage, https://datacreatorai.com
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.32

# DataCreator AI – Software Development Kit (SDK)

A lightweight, proprietary Python client for accessing the **DataCreator AI** synthetic data generation API. This SDK is designed for desktop and server environments, enabling programmatic dataset generation with simple Python calls.

---

## Installation

<!-- ### From TestPyPI (recommended during beta-testing)

```bash
pip install -i https://test.pypi.org/simple --extra-index-url https://pypi.org/simple datacreator-sdk
``` -->

## Usage Overview

The `DataCreatorClient` provides a single primary method, `generate()`, that generates conversations suitable for fine-tuning AI models. The SDK handles communication, progress messages, response validation, and writing the final dataset to a `.jsonl` file.

---

## `generate()` Method

The `generate()` function triggers the synthetic data generation workflow and saves the final dataset locally.

### **Purpose**

Initiates a dataset generation request and produces a `.jsonl` file containing structured conversational examples aligned with your specified theme.

### **Authentication**
Please contact us at team@datacreatorai.com for a API Key. Once you've received your unique key, send it during instantiation as shown in the example code.

### **Parameters**

The method accepts the following arguments:

- **`main_theme` (str, required)**  
  The central topic around which the synthetic dataset should be generated.  
  Example: `"Daily tasks and personal planning for young working professionals"`
  Any harmless and non-NSFW topic is allowed.

- **`num_of_turns` (int, optional, default: 3)**  
  Number of conversational turns per datapoint. The maximum number of turns allowed is 5.
  A "turn" is typically one `user → assistant` exchange. The generation supports multiple message roles including **user**, **assistant**, **system**, and **tool**.
  Example: `2` turns produces:  
  - user  
  - assistant  
  - user  
  - assistant  

- **`num_of_datapoints` (int, optional, default: 100)**  
  Number of independent dialogues/conversations to generate. 
  The maximum number of data points allowed per generation is 1000.
  Example: `10` produces 10 conversations.

- **`language` (str, optional, default: "English")**  
  The language in which the dataset should be generated.

- **`system_prompt` (str, optional)**  
  A custom instruction or persona that the assistant should follow throughout the conversations.

- **`max_tokens` (int, optional, default: 2048)**  
  The maximum token limit for each conversation.

- **`use_rolling_temperatures` (bool, optional, default: False)**  
  When set to `True`, the generator uses varying temperatures across data points to ensure **higher lexical diversity**.

- **`use_model_rotation` (bool, optional, default: False)**  
  When set to `True`, the system rotates between different high-quality models to provide **better structural diversity**.

- **`output_file` (str, optional, default: "dataset.jsonl")**  
  The path and filename where the final dataset will be written.  
  Example: `"data.jsonl"`

The final dataset is a **JSON Lines (`.jsonl`) file**, where each line represents a conversation formatted as a list of messages. This format is fully compatible for fine-tuning with providers like OpenAI, Mistral, and Anthropic. 

The SDK supports the following message roles:
- **`system`**: Sets the context or behavior of the assistant.
- **`user`**: The human/user prompt.
- **`assistant`**: The model's response.
- **`tool`**: Represents tool outputs or function calls (experimental).

### Example Code

```bash

import os
from dotenv import load_dotenv
from datacreatoraisdk import DataCreatorClient

load_dotenv()

# Example usage
if __name__ == "__main__":
    client = DataCreatorClient(api_key=os.getenv("DATACREATOR_API_KEY"))
    client.generate(
        main_theme="Natural dialogues between a user and assistant asking about daily tasks, errands, and emotions.", 
        num_of_turns=2, 
        num_of_datapoints=100,
        use_rolling_temperatures=True,
        use_model_rotation=False
    )

```
