Provider-organized schema + ingestion/cleanup pipeline for AI chat exports
Project description
Chat History Schema
Provider-organized schema + ingestion/cleanup pipeline for chat history exports.
Purpose
This repo is for cleaning up raw chat data exports.
The final merged output can be used for downstream data analysis and visualizations across your past ChatGPT and Claude conversations.
Structure
chat-history-schema/
model/
openai/
anthropic/
scripts/
combine_conversations.py
parse_validate_clean.py
merge_provider_histories.py
run_pipeline.py
data/
raw/{openai,anthropic}/
combined/{openai,anthropic}/
merged/
Workflow
- Drop raw exports into:
data/raw/openai/data/raw/anthropic/
- Combine raw files by provider:
- All providers:
python scripts/combine_conversations.py --provider all - One provider only:
- OpenAI:
python scripts/combine_conversations.py --provider openai - Anthropic:
python scripts/combine_conversations.py --provider anthropic
- OpenAI:
- All providers:
- Validate by provider:
- All providers:
python scripts/parse_validate_clean.py --provider all - One provider only:
- OpenAI:
python scripts/parse_validate_clean.py --provider openai - Anthropic:
python scripts/parse_validate_clean.py --provider anthropic
- OpenAI:
- All providers:
- Merge provider histories with a
providerfield (this command validates before writing output):- All providers:
python scripts/merge_provider_histories.py --provider all - One provider only:
- OpenAI:
python scripts/merge_provider_histories.py --provider openai - Anthropic:
python scripts/merge_provider_histories.py --provider anthropic
- OpenAI:
- All providers:
One-command end-to-end run
Run combine + validate + merge in one command:
- All providers:
python scripts/run_pipeline.py --provider all
- One provider only:
python scripts/run_pipeline.py --provider openaipython scripts/run_pipeline.py --provider anthropic
Script outputs
scripts/combine_conversations.py- Writes:
data/combined/openai/conversations.json(when provider includesopenai)data/combined/anthropic/conversations.json(when provider includesanthropic)
- Writes:
scripts/parse_validate_clean.py- Writes: no files
- Prints terminal validation results only
scripts/merge_provider_histories.py- Writes:
- If you do nothing:
data/merged/all-conversations-clean.pkl - If you want a different file: pass
--output-pkl <your/path.pkl>
- If you do nothing:
- Main argument:
--provider all|openai|anthropic
- Writes:
scripts/run_pipeline.py- Writes:
- Combined JSON files under
data/combined/<provider>/conversations.json - Final merged pickle:
- If you do nothing:
data/merged/all-conversations-clean.pkl - If you want a different file: pass
--output-pkl <your/path.pkl>
- If you do nothing:
- Combined JSON files under
- Writes:
Validation behavior (make it your own)
This schema is intentionally strict and not meant to be a final bulletproof version for every export.
It is designed to surface structure differences early, so you can evolve it to match your own history.
- Models use strict validation (
extra='forbid') so unknown fields fail fast instead of being silently ignored. - You may see validation errors because chat histories differ by provider, account features, tool usage, and export date.
- Treat validation as an iterative loop:
- Run validation.
- Read terminal errors.
- Update
model/openai/*ormodel/anthropic/*to support the new shape. - Rerun until validation passes.
If you want this repo to fit your data long-term, keep extending the provider schemas as your exports evolve.
Inspiration
This repo was inspired by the original ChatGPT schema project:
https://github.com/ryayoung/chatgpt-schema
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 chat_history_schema-0.1.0.tar.gz.
File metadata
- Download URL: chat_history_schema-0.1.0.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfbf0db01287935aff0a018589a107d6f566274fdf1e69181547fbcafc745007
|
|
| MD5 |
7bf0f8b2a86bb2d8c24dbc1b72fd6f14
|
|
| BLAKE2b-256 |
021d38731c79d360ad71b0487a546c933e24671550ba34d45cbd4d4b313352e5
|
File details
Details for the file chat_history_schema-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chat_history_schema-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47d4146cad37e39d356f5be0af1d647205ea4bc3fd525cbdf52f4657f45b983c
|
|
| MD5 |
9929732a084b69812284c2ba439c3d65
|
|
| BLAKE2b-256 |
e1bac4ece9e27eeab23e1aaa107c88a5a7598953afeedfa4e16c381b2da2bd42
|