Data preparation system to build controllable AI system
Project description
⬜️ Open Datagen ⬜️
Open Datagen is a Data Preparation Tool designed to build Controllable AI Systems
It offers improvements for:
RAG: Generate large Q&A datasets to improve your Retrieval strategies.
Evals: Create unique, “unseen” datasets to robustly test your models and avoid overfitting.
Fine-Tuning: Produce large, low-bias, and high-quality datasets to get better models after the fine-tuning process.
Guardrails: Generate red teaming datasets to strengthen the security and robustness of your Generative AI applications against attack.
Additional Features
-
Use external sources to generate high-quality synthetic data (Local files, Hugging Face datasets and Internet)
-
Data anonymization
-
Open-source model support + local inference
-
(SOON) Open DataGen Agent
-
(SOON) Web or Desktop app 🤔
Installation
pip install --upgrade opendatagen
Setting up your API keys
export OPENAI_API_KEY='your_openai_api_key' #(using openai>=1.2)
export MISTRAL_API_KEY='your_mistral_api_key'
export TOGETHER_API_KEY='your_together_api_key'
export HUGGINGFACE_API_KEY='your_huggingface_api_key'
export SERPLY_API_KEY='your_serply_api_key' #Google Search API
Usage
Example: Generate a low-biased dataset to improve factuality of an LLM.
template.json:
{
"factuality": {
"description": "Factuality",
"prompt": "Given the following text:\n\n'''{wikipedia_content}'''\n\nAnswer to this factually checkable question:\n'''{question}'''.",
"completion": "Answer: '''{answer}'''. Rate the answer out of 10: {score}",
"prompt_variation_number": 0,
"variables": {
"wikipedia_content": {
"name": "Wikipedia content",
"generation_number": 1,
"get_value_from_huggingface": {
"dataset_name": "20220301.en",
"dataset_path": "wikipedia",
"column_name": "text",
"max_tokens": 512
}
},
"question": {
"name": "Factually checkable question",
"generation_number": 3,
"models": [
{
"openai_chat_model": {
"name": "gpt-3.5-turbo-1106",
"temperature": [0, 1],
"max_tokens": 128
}
}
]
},
"answer": {
"name": "Short answer to the question",
"generation_number": 1,
"models": [
{
"openai_instruct_model": {
"name": "gpt-3.5-turbo-instruct",
"temperature": [0, 1],
"max_tokens": 128,
"start_with": ["Answer:"]
}
}
]
},
"score": {
"name": "Score",
"generation_number": 1,
"note": ["You must answer with an integer."],
"models": [
{
"openai_chat_model": {
"name": "gpt-3.5-turbo-1106",
"temperature": [0, 1],
"max_tokens": 5
}
}
]
}
}
}
}
Python code to generate the dataset:
from opendatagen.template import TemplateManager
from opendatagen.data_generator import DataGenerator
output_path = "factuality.csv"
template_name = "factuality"
manager = TemplateManager(template_file_path="template.json")
template = manager.get_template(template_name=template_name)
if template:
generator = DataGenerator(template=template)
data = generator.generate_data(output_path=output_path)
print(data)
Using this template you will:
- Get text content from the Wikipedia dataset hosted on HuggingFace
- Generate 3 questions about this content
- Generate an short answer
- Rate the answer
Contribution
We welcome contributions to Open Datagen! Whether you're looking to fix bugs, add templates, new features, or improve documentation, your help is greatly appreciated.
Note
Please note that opendatagen is initially powered by OpenAI's models. Be aware of potential biases and use the note field to guide outputs.
Acknowledgements
We would like to express our gratitude to the following open source projects and individuals that have inspired and helped us:
-
Textbooks are all you need (Read the paper)
-
Evol-Instruct Paper (Read the paper) by WizardLM_AI
-
Textbook Generation by VikParuchuri
Connect
If you need help for your Generative AI strategy, implementation, and infrastructure, reach us on
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opendatagen-0.0.26.tar.gz.
File metadata
- Download URL: opendatagen-0.0.26.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.29.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/5.1.0 keyring/21.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330b6bf59c9b9d7a8bf963b2cdbc95adbceec8973497ef7a6c89a01cd9978d20
|
|
| MD5 |
3675934c0bef11bb74228ecc8cef6d82
|
|
| BLAKE2b-256 |
bf7fc69371250239707d3e40636a7ec0426add4d76c826ae4046c72695084637
|
File details
Details for the file opendatagen-0.0.26-py3-none-any.whl.
File metadata
- Download URL: opendatagen-0.0.26-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.29.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/5.1.0 keyring/21.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c7daaa227b69e123a9af07cb2f5b6a67877e1fc883b593ac75a246e37d59b11
|
|
| MD5 |
4a0d113e48118b3c98c02bccae5bdf08
|
|
| BLAKE2b-256 |
5cd0120abdec06ca61fd3e8ff965096247cb72845958689aedd366b655f39955
|