This package provides LangChain integration for Nebius AI Studio, enabling seamless use of Nebius AI Studio's chat and embedding models within LangChain. It offers classes for chat models (ChatNebius), embedding models (NebiusEmbeddings), and a retriever (NebiusRetriever), facilitating common LLM application patterns like RAG. The current version is 0.1.3.
pip install langchain-nebiusVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize `ChatNebius` and invoke it with a simple query. Ensure your `NEBIUS_API_KEY` is set as an environment variable for secure credential management. You may need to select a specific model available in Nebius AI Studio.
Set `export NEBIUS_API_KEY='your_api_key'` in your environment or use a `.env` file and `dotenv`.
Refer to the `langchain-nebius` GitHub repository or PyPI page for explicit `langchain-core` version requirements. Use `pip install -U langchain-nebius` to get the latest compatible version.
Consult the official Nebius AI Studio documentation for up-to-date model names and availability. Avoid hardcoding model names if they are subject to frequent changes.
Implement retry mechanisms with exponential backoff for API calls. Monitor token usage and truncate input or summarize history if close to context limits. Review Nebius AI Studio's API documentation for specific rate limits and model context window sizes.
Ensure the package is installed in your active Python environment: `pip install langchain-nebius`
Set the `NEBIUS_API_KEY` environment variable (e.g., `export NEBIUS_API_KEY='your_api_key'`) or pass it directly during initialization: `ChatNebius(api_key='your_api_key', ...)`.
Consult the official Nebius AI Studio documentation for the most current list of supported model names and use a valid identifier, e.g., `ChatNebius(model='Qwen/Qwen3-14B')`.
Upgrade `langchain-nebius` and your main `langchain` and `langchain-core` packages to their latest compatible versions: `pip install -U langchain-nebius langchain langchain-core`.