Nebius Text Embeddings
Nebius AI Studio provides API access to high-quality embedding models through a unified interface. The Nebius embedding models convert text into numerical vectors that capture semantic meaning, making them useful for various applications like semantic search, clustering, and recommendations.
Overview
The NebiusEmbeddings
class provides access to Nebius AI Studio's embedding models through LangChain. These embeddings can be used for semantic search, document similarity, and other NLP tasks requiring vector representations of text.
Integration details
- Provider: Nebius AI Studio
- Model Types: Text embedding models
- Primary Use Case: Generate vector representations of text for semantic similarity and retrieval
- Available Models: Various embedding models including BAAI/bge-en-icl and others
- Dimensions: Varies by model (typically 1024-4096 dimensions)
Setup
Installation
The Nebius integration can be installed via pip:
%pip install --upgrade langchain-nebius
Credentials
Nebius requires an API key that can be passed as an initialization parameter api_key
or set as the environment variable NEBIUS_API_KEY
. You can obtain an API key by creating an account on Nebius AI Studio.
import getpass
import os
# Make sure you've set your API key as an environment variable
if "NEBIUS_API_KEY" not in os.environ:
os.environ["NEBIUS_API_KEY"] = getpass.getpass("Enter your Nebius API key: ")
Instantiation
The NebiusEmbeddings
class can be instantiated with optional parameters for the API key and model name:
from langchain_nebius import NebiusEmbeddings
# Initialize the embeddings model
embeddings = NebiusEmbeddings(
# api_key="YOUR_API_KEY", # You can pass the API key directly
model="BAAI/bge-en-icl" # The default embedding model
)
Available Models
The list of supported models is available at https://studio.nebius.com/?modality=embedding