Ir para o conteúdo

langchain_adapter

module wittgenstein_embeddings.langchain_adapter

Classes

wittgenstein_embeddings.langchain_adapter.LangChainEmbeddingAdapter

class LangChainEmbeddingAdapter(client: EmbeddingClient)

Bases : Embeddings

Bridges an EmbeddingClient to LangChain's Embeddings ABC.

embed_query -> EmbeddingClient.query (retrieval time) embed_documents -> EmbeddingClient.passage_batch (indexing time)

LangChain's PGVector already calls only embed_query on similarity_search* and only embed_documents on add_documents — the query/passage split this adapter bridges to is exactly the split PGVector already exercises, so no changes are needed on the vectorstore side.

Isolated in its own module (not re-exported from the package's top-level __init__.py, and not imported by any other module in this package) so importing wittgenstein_embeddings never requires langchain_core — only consumers that actually need LangChain compatibility import this module directly, and get an immediate ImportError here (not a try/except) if langchain-core isn't installed, which is the correct behavior for an explicit opt-in import.

Methods

wittgenstein_embeddings.langchain_adapter.LangChainEmbeddingAdapter.embed_query

method LangChainEmbeddingAdapter.embed_query(text: str) → list[float]

wittgenstein_embeddings.langchain_adapter.LangChainEmbeddingAdapter.embed_documents

method LangChainEmbeddingAdapter.embed_documents(texts: list[str]) → list[list[float]]