HTS MCP
Skip to Content
CLIEnrichment

Enrichment

CLI commands for AI enrichment and embedding generation.

enrich-hts6

Generate AI-powered descriptions, keywords, and exclusionary terms for 6-digit HTS codes.

Usage

uv run hts enrich-hts6

Details

For each HTS6 code:

  1. Collects all child HTS8 descriptions
  2. Calls GPT-5.4 Nano with a structured prompt
  3. Receives: enriched description (max 100 chars), 5-7 keywords, exclusionary terms, common attributes
  4. Stores in hts6_enrichments

Configuration:

  • enrichment_model: LLM model (default: gpt-5.4-nano)
  • enrichment_temperature: Temperature (default: 0.1)
  • enrichment_batch_size: Codes per batch (default: 50)
  • enrichment_max_workers: Concurrent threads (default: 25)

Idempotent: Skips already-enriched codes on re-run.

Example Output

Enriching HTS6 codes... Processed: 5,714 | Skipped: 0 | Errors: 3 Time: 892.4 seconds

generate-embeddings

Generate embeddings for HTS8 codes only. This is the legacy single-level command.

Usage

uv run hts generate-embeddings

Details

Generates text-embedding-3-small embeddings for all HTS8 tariff descriptions. For multi-level embeddings (chapter, hts4, hts6, hts8), use generate-multilevel-embeddings instead.


generate-multilevel-embeddings

Generate OpenAI embeddings at multiple hierarchy levels with full and short text variants.

Usage

uv run hts generate-multilevel-embeddings

Details

Generates embeddings for all combinations of:

  • Levels: chapter, hts4, hts6, hts8
  • Variants: full (with hierarchical context), short (description only)

Uses the text builder to construct embedding text. See Data Model: Embeddings for text formats.

Configuration:

  • embedding_model: OpenAI model (default: text-embedding-3-small)
  • embedding_batch_size: Texts per API call (default: 500)

Example Output

Generating multi-level embeddings... chapter: 98 (full) hts4: 961 (full) hts6: 11,428 (full + short) hts8: 25,538 (full + short) Total: 38,025 embeddings in 634.2 seconds

embeddings-status

Show embedding availability and per-level breakdown.

Usage

uv run hts embeddings-status

Example Output

Embedding Status ================ Level Variant Count ───── ─────── ───── chapter full 98 hts4 full 961 hts6 full 5,714 hts6 short 5,714 hts8 full 12,769 hts8 short 12,769 ───────────────────────────── Total: 38,025