LiteLLMEmbeddings()LiteLLM embedding model.
Uses litellm.embedding() to support 100+ providers through a unified
interface. All provider configuration (api_key, api_base, etc.) can be
passed explicitly—no environment variables required.
Example:
.. code-block:: python
from langchain_litellm import LiteLLMEmbeddings
embeddings = LiteLLMEmbeddings( model="openai/text-embedding-3-small", api_key="sk-...", ) vectors = embeddings.embed_documents(["hello", "world"])
For providers that distinguish document vs query embeddings (Cohere,
Voyage, Vertex AI, etc.), set document_input_type and
query_input_type:
.. code-block:: python
embeddings = LiteLLMEmbeddings(
model="cohere/embed-english-v3.0",
api_key="...",
document_input_type="search_document",
query_input_type="search_query",
)