A library for generating instruction-following data using agent-based workflows.
Project description
open-agentinstruct
An open-source recreation of the AgentInstruct agentic workflow.
open-agentinstruct is a project aimed at recreating the AgentInstruct agentic workflow. It supports any LiteLLM model to be used in the agentic synthetic data generation worflow. The AgentInstruct workflow involves three agentic step for synthetic data generation based on "seed" data:
- Content Transformation: Transforms text content using various agent configurations.
- Instruction Generation: Generates instructions based on transformed content.
- Instruction Refinement: Refines generated instructions to enhance complexity and challenge.
Table of Contents
- Supported tasks
- Supported seed datasets
- Features
- Installation
- Usage
- Example of generated data
- Project Structure
Supported tasks
The AgentInstruct paper implements the following tasks which are all implemented in open-agentinstruct:
- Reading Comprehension
- Open Domain Question Answering
- Text Modification
- Web Agent
- Brain Teaser
- Analytical Reasoning
- Multiple Choice Questions
- Data To Text
- Fermi
- Coding
- Text Extraction
- Text Classification
- Retrieval Augmented Generation
- Tool Use
- Creative Content Generation
- Few Shot Reasoning
- Conversation
Supported seed datasets
- Any HF datasets:
- The AgentInstruct paper uses the following:
- Knowledge Pile
- AutoMathText
- subset of openstax
- subset Apache 2.0 from codeparrot/github-code-clean
- The AgentInstruct paper uses the following:
- Any set of user-provided seed
.pdfs
Features
- LiteLLM compatible LLMs
- Finetuning pipeline for llama3
Installation
Option 1: Install from PyPI (Recommended for users)
Once the package is published, you can install it directly using pip:
pip install open-agentinstruct
Option 2: Install from source (For developers)
-
Clone the repository:
git clone https://github.com/ThomasRochefortB/open-agentinstruct.git cd open-agentinstruct
-
Create a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
-
Install the package in editable mode along with development dependencies:
pip install -e ".[dev]"
-
Set up your API keys necessary to use the desired LiteLLM model(s):
- Create a
.envfile in the root directory (or wherever you run the command). - Add your API key(s) to the
.envfile (the library usespython-dotenvto load them):# Example for OpenAI OPENAI_API_KEY=your_openai_api_key # Add other keys as needed (e.g., COHERE_API_KEY, ANTHROPIC_API_KEY) # ...
- Create a
Usage
The primary way to use the data generation workflow is through the command-line interface:
# Basic usage with a Hugging Face dataset
open-agentinstruct-generate --dataset-names <hf/datasetname> --task-name <your_task_name>
# Example: Generate reading comprehension data from the first 100 chunks of openstax
open-agentinstruct-generate --dataset-names "crumb/openstax-text" --task-name reading_comprehension --max-chunks 100
# Generate data for all tasks from the specified dataset, processing max 100 chunks, skipping refinement, including content
open-agentinstruct-generate --dataset-names "crumb/openstax-text:text:train:20000" --model gemini/gemini-2.0-flash --max-chunks 100 --output-dir ./output
# Example: Generate data for all tasks from a PDF directory, including original content
open-agentinstruct-generate --pdf-dir path/to/your/pdfs --all-tasks --include-content
# See all available options
open-agentinstruct-generate --help
Generated data will be saved to ./data/generated_data/<task_name>.jsonl by default.
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 open_agentinstruct-0.1.0.tar.gz.
File metadata
- Download URL: open_agentinstruct-0.1.0.tar.gz
- Upload date:
- Size: 93.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b027ad9ff3d1c457700446667f8238577556e046f66ae7488e7042d7b6d5a484
|
|
| MD5 |
07f20a18814f5fbf3686e46b69a86615
|
|
| BLAKE2b-256 |
5109953133afd2191e36244b23cc61953dfca631d7fd5bce1a73712c6b26f548
|
File details
Details for the file open_agentinstruct-0.1.0-py3-none-any.whl.
File metadata
- Download URL: open_agentinstruct-0.1.0-py3-none-any.whl
- Upload date:
- Size: 115.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c7cff277a262513f940ac323d939c4251557fe379fac4063cde5fabcd5d7b24
|
|
| MD5 |
82ce116e54a6dc69b73dd5698ecd47ad
|
|
| BLAKE2b-256 |
156732afc40a42f022331032d7417aa63b9756055700b0dbf52edc23d05be9e8
|