Hanzo AI Format - Universal .ai file format for AI artifacts
This crate provides a standard format for packaging, distributing, and sharing AI artifacts across the Hanzo/Zoo network. The .ai format supports:
- Model weights and biases
- Fine-tuning deltas (LoRA, QLoRA)
- Quantized models (GGUF, AWQ, GPTQ)
- Datasets and evaluation data
- Embeddings and vector stores
- Agent state and memory
- Configuration and hyperparameters
File Structure
artifact.ai (ZIP archive with .ai extension)
├── manifest.json # Artifact metadata and manifest
├── data/ # Primary artifact data
│ ├── weights/ # Model weights (safetensors, bin, etc.)
│ ├── config/ # Model configuration
│ └── tokenizer/ # Tokenizer files
├── delta/ # Fine-tuning deltas (optional)
├── dataset/ # Training/eval datasets (optional)
├── embeddings/ # Pre-computed embeddings (optional)
├── state/ # Agent state/memory (optional)
└── signatures/ # Cryptographic signatures
Storage Backends
The format supports multiple storage backends:
- Local filesystem
- HuggingFace Hub (fallback/mirror)
- P2P swarm (BitTorrent-style distribution)
- IPFS (content-addressed storage)
Example
use hanzo_ai_format::{AiArtifact, ArtifactType, Storage};
// Create a new artifact
let artifact = AiArtifact::builder()
.name("my-model")
.artifact_type(ArtifactType::Model)
.add_weights("weights.safetensors", weights_data)
.build()?;
// Save to .ai file
artifact.save("my-model.ai").await?;
// Upload to storage
let storage = Storage::new_with_hf_fallback();
storage.upload(&artifact).await?;