classifiers.migrate_embeddings_redisearch module

Copy monolithic tool/skill embedding hashes into per-key RediSearch HASH docs.

Run after ensure_indexes has created idx:tool_embeddings and idx:skill_embeddings. Safe to re-run (overwrites tool_emb:* / skill_emb:* keys from legacy hash data).

Usage:

python -m classifiers.migrate_embeddings_redisearch
classifiers.migrate_embeddings_redisearch.main()[source]

CLI entrypoint that resolves the Redis URL and drives the migration.

Parses --redis-url from argv, loads configuration via Config.load(), and resolves the effective Redis URL with the precedence --redis-url > cfg.redis_url > $REDIS_URL > redis://localhost:6379/0. It derives connection keyword arguments through Config.redis_connection_kwargs_for_url() and then runs the async _run() coroutine via asyncio.run() to perform the actual hash migration.

Side effects: triggers the Redis writes performed by _run() and logs an error (with traceback) if the migration raises. Any exception is caught here and converted into a non-zero return code rather than propagating.

Invoked from the module’s __main__ guard via raise SystemExit(main()). No other internal callers were found.

Return type:

int

Returns:

0 on a successful migration, 1 if _run() raised.