Skip to main content

Crate hanzo_ai_format

Crate hanzo_ai_format 

Source
Expand description

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?;

Re-exports§

pub use artifact::*;
pub use error::*;
pub use manifest::*;
pub use storage::*;

Modules§

artifact
AI Artifact - Read/write .ai files
error
Error types for hanzo-ai-format
manifest
Manifest - File listing and metadata for .ai archives
storage
Storage backends for AI artifacts

Structs§

ArtifactMetadata
Metadata about the artifact
ArtifactRef
Unique identifier for artifacts
ArtifactStats
Statistics about artifact usage across the network
ComputeRequirements
Compute requirements for using this artifact

Enums§

ArtifactType
Type of AI artifact
DatasetTask
Dataset task type
DeltaMethod
Fine-tuning delta method
License
License type for artifacts
Network
Network where artifact is available
QuantFormat
Quantization format
StorageLocation
Storage location for an artifact

Constants§

AI_EXTENSION
File extension for AI artifacts
AI_MAGIC
Magic bytes for .ai file format
FORMAT_VERSION
Current format version

Type Aliases§

ArtifactId
Artifact identifier (content-addressed)