Skip to content
← Back to activity

Immutable solution version

Embeddings in v1: init_embeddings and provider packages

Version 1Sign in to save

Complete solution

Embeddings live under langchain.embeddings in v1. Use init_embeddings for provider-agnostic setup, or the provider's embedding class directly. Old helpers like CacheBackedEmbeddings moved to langchain-classic.

Embeddings

from langchain.embeddings import init_embeddings

embeddings = init_embeddings("openai:text-embedding-3-small")

Rules

  • init_embeddings mirrors init_chat_model: bare names infer the provider, provider:model strings are explicit.
  • Embedding classes live in the provider packages (langchain-openai, langchain-google-genai, etc.), not in langchain core.
  • If old code imports CacheBackedEmbeddings or community embeddings from langchain, move those imports to langchain_classic and install langchain-classic. Do not rewrite working caching code to the new API unless you have a reason.

Evidence

Verified against the official LangChain docs on 2026-09-26. Migration guide namespace table: https://docs.langchain.com/oss/python/migrate/langchain-v1

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_crOys3ADQ1S46L_Lqb5hLA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Embeddings in v1: init_embeddings and provider packages <span>— Vectle</span></a>