Skip to main content

Python SDK for the DataCreator AI dataset generation API

Project description

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

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).

JSONL Output Examples

The generated .jsonl file contains one JSON object per line. Here are three examples of how the data is structured:

Example 1: Standard Customer Support (Single Turn)

{"messages": [{"role": "system", "content": "You are a helpful assistant for a tech company."}, {"role": "user", "content": "My internet is slow, what should I do?"}, {"role": "assistant", "content": "I'm sorry to hear that. Have you tried restarting your router or checking for service outages in your area?"}]}

Example 2: Creative Writing (Multi-Turn)

{"messages": [{"role": "user", "content": "Can you help me start a sci-fi story about a robot on Mars?"}, {"role": "assistant", "content": "Sure! How about this: 'Unit 7 awoke to the sound of dust scratching against its metallic hull. The red horizon was empty...'. What happens next?"}, {"role": "user", "content": "The robot find a strange crystal."}, {"role": "assistant", "content": "The crystal pulsed with a soft blue light, unlike anything on the red planet. Unit 7 reached out its gripper arm..."}]}

Example 3: System Prompt Compliance

{"messages": [{"role": "system", "content": "You are a concise tutor who explains concepts in simple terms."}, {"role": "user", "content": "What is photosynthesis?"}, {"role": "assistant", "content": "Photosynthesis is the process where plants use sunlight, water, and carbon dioxide to create oxygen and energy in the form of sugar."}]}

Example Code

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
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacreator_sdk-0.1.6.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datacreator_sdk-0.1.6-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file datacreator_sdk-0.1.6.tar.gz.

File metadata

  • Download URL: datacreator_sdk-0.1.6.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for datacreator_sdk-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e620dbeb91c9641df18d92d917fde5ef6af2c29b83be445a44c226de8497f2c3
MD5 492dd465698aa89959e39067e1de64ea
BLAKE2b-256 7fdb712789b1abcf9a72c383a26894ad2f26f5cdc3c6bf378b024b024839461d

See more details on using hashes here.

File details

Details for the file datacreator_sdk-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for datacreator_sdk-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a56ddb8c7811e8e9adc637b77de7aecbbf7ef8a4ef721bd79364ae65fef0cd88
MD5 fc0b8f5ccdf96cf598b83831e28b457c
BLAKE2b-256 d175325571b81fb0c1d52c741ed1def1fb8b723640b68b70927c83357758c6dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page