Skip to content
Back to skills

Swap Embeddings

ASecurity

Change the embedding model used to index and search documents (OpenAI, Cohere, Voyage, a local server). Use when the user decides on a different or cheaper embedding model, or asks about vector dimensions. Not for debugging; when something fails, use the debug skill.

  • 30 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 8, 2026
ai-agentspythondebuggingapisecurity

Works with

  • api

Security analysis

A100/100

Scanned November 8, 2026

npx -y skills add majiayu000/claude-skill-registry-data --skill swap-embeddings --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Swap Embeddings?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Swap Embeddings
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-swap-embeddings/badge)](https://www.skillsdirectory.com/skills/majiayu000-swap-embeddings)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: swap-embeddings
description: Change the embedding model used to index and search documents (OpenAI, Cohere, Voyage, a local server). Use when the user decides on a different or cheaper embedding model, or asks about vector dimensions. Not for debugging; when something fails, use the debug skill.
disable-model-invocation: true
---

# Swap the embedding model

- **Interface:** `Embedder` (`name`, `min_score`, `embed(texts)`) in
  `apps/ai/app/embeddings.py`.
- **Today:** `HashingEmbedder` locally (lexical, no model; refused in production) and
  `ProviderEmbedder` for any Pydantic AI embedding model, asked for
  `EMBEDDING_DIMENSIONS` (1536, `apps/ai/app/db/models.py`). `create_embedder` picks one.
- **Env:** `AI_EMBEDDINGS` (`hashing` or a model name such as
  `openai:text-embedding-3-small`), `AI_MIN_RELEVANCE` (cosine floor), and the provider's
  key (e.g. `OPENAI_API_KEY`).

## Swap

1. Same dimension (1536): set `AI_EMBEDDINGS` and the key, then re-index every document
   (vectors from different models aren't comparable; documents keep their text).
2. A different dimension: a migration changing `ai.chunk`'s vector column and its HNSW
   index (db-change skill), `EMBEDDING_DIMENSIONS` in `apps/ai/app/db/models.py`, and a
   re-index.
3. A model Pydantic AI can't reach: a class with the `Embedder` shape, chosen in
   `create_embedder`.
4. Calibrate `AI_MIN_RELEVANCE` for the new model with `bun run --cwd apps/ai evals`.

## Tests

`apps/ai/tests/test_units.py` (embedders), `apps/ai/tests/test_service.py` (indexing and
retrieval against Postgres), `apps/ai/tests/test_models_match_db.py` after a migration.

## Finish

1. The verify skill.
2. Ask the `reviewer` agent to review the change, and the `security-reviewer` agent: a
   new implementation brings its own credentials and sends data somewhere new. If you
   wrote a migration, the `migration-reviewer` agent too. The change is in apps/ai, so the
   `python-reviewer` agent as well.
3. Update the seam's row in the README's "Scaling path" table if what's "Now" changed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.