LangChain Nebius Integration

0.1.3 · active · verified Sun Apr 12

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.

Warnings

Install

Imports

Quickstart

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.

import os
from langchain_nebius import ChatNebius
from langchain_core.messages import HumanMessage

# Set your Nebius API key as an environment variable
# os.environ["NEBIUS_API_KEY"] = "your_nebius_api_key"

chat = ChatNebius(
    api_key=os.environ.get('NEBIUS_API_KEY', ''),
    model="Qwen/Qwen3-14B", # Choose an available model from Nebius AI Studio
    temperature=0.6
)

response = chat.invoke([
    HumanMessage(content="What is 1 + 1?")
])

print(response.content)

view raw JSON →