Skip to main content

Convector

Introduction

Convector is a tool designed to facilitate the unification of conversational datasets into a consistent format. Capable of handling various dataset formats including JSONL, Parquet, Zstandard (Zst), JSON.GZ, CSV, and TXT, Convector converts them into JSONL format. The user can choose to filter data during transformation for enhanced customization. It offers flexibility in output formats with options like the default format and chat_completion format, the latter being compliant with OpenAI's format.

Installation

Convector can be installed either via PyPI or directly from GitHub.

  • Using PyPI: Run pip install convector in the terminal.
  • Using GitHub: Clone and install using the following commands:
    git clone https://github.com/teilomillet/convector
    cd convector
    pip install .
    

Usage

Convector provides a command-line interface for easy data processing with various customization options.

  • Basic Command: convector process <file_path> [OPTIONS]

  • Options:

    • -p, --profile: Predefined profile from the config (default is 'default').
    • -c, --conversation: Allow to process conversational exchanges.
    • --instruction: Key for instructions or system messages.
    • -i, --input-key: Key for user inputs.
    • -o, --output-key: Key for bot responses.
    • -s, --schema: Schema of the output data.
    • --filter: Filter conditions in "field,operator,value" format.
    • -l, --limit: Limit to a number of lines.
    • --bytes: Limit to a number of bytes.
    • -f, --file-out: File for transformed data.
    • -d, --dir-out: Directory for output files.
    • -v, --verbose: Enable detailed logs.
  • Example Commands:

    • Process each file in a folder:
      convector process /path/to/data/
      

    • Process the file data.jsonl, which is a conversation -c, keep all the data with an id under 10500, the output will be saved in /path/to/output_dir/output.jsonl:
      convector process /data.jsonl -c --filter id<10500 -f output.jsonl -d /output_dir/
      

    • Process the file data.parquet and output the data into a chat_completion format with the id and user_id at each row. (the output data will be saved in data_tr.jsonl inside the default output location (convector/silo)):
      convector process /data.parquet --filter "id;user_id" --schema chat_completion
      

    • Register a profile name sampler, process 333 lines of the file data.parquet and save the output into a chat_completion format in a file name sampler.jsonl:
      convector process /data.json -p sampler -l 333 -s chat_completion -f sampler.jsonl
      

    • Process all the files in the folder /data, using all the commands previously saved in the profile sampler (see above):
      convector process /data/ -p sampler
      

Advanced Features

  • Conversational Data Handling: Convector efficiently processes nested conversational data. Using the --conversation command, it can identify and handle complex conversation structures, auto-generating a conversation_id when needed.
  • Customization: Users can customize the data fields to be retained during processing with the --filter option. By default, Convector keeps instruction, input, and output. Additional fields can be included as required.
  • Folder Handling: Convector can go through folders to process the data inside it. It will by default, create a file using _tr at the end if no --file-out is specified.

Configuration and Customization

  • Profile Customization: Users can define and use custom profiles for different types of data processing tasks inside the config.yaml. The profile will automatically be saved and updated if used with new commands.
  • Schema Application: Convector allows for the application of custom schemas to tailor the output according to specific requirements.
    • Default Schema:
      {"instruction":"","input":"","output":"","source":""}
      
    • Chat_completion Schema:
      "messages": [
          {"role": "system", "content": ""},
          {"role": "user", "content": ""},
          {"role": "assistant", "content": ""}
      ],
      "source":""
      

Metadata

Release files for convector 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for convector 0.1.1
File Size Uploaded Provenance
convector-0.1.1.tar.gz 34.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for convector 0.1.1
File Interpreter ABI Platform
convector-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 77.2 kB

Release files / convector-0.1.1.tar.gz

Download URL convector-0.1.1.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fa1e6fc739d211c3412d108f528c110112b5790dc96f843de2e834dd40f9f591
BLAKE2b-256 checksum
How to use checksums
0bd12c504cd637d5a40f7a71ac24a2e1b1db2b91baf35a79713a09f5011ea2b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / convector-0.1.1-py3-none-any.whl

Download URL convector-0.1.1-py3-none-any.whl
Size 42.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f6185413c5dd44b2e8a15527f24e3708478177fb68e8b42f65cef05f4acaa24
BLAKE2b-256 checksum
How to use checksums
81f72ff917736f81a33fc01110c2fd87a21f806b5c1df09a6bd44994270cb72d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for convector 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page