Skip to main content

llama-index llms Nebius AI Studio integration

Project description

LlamaIndex Llms Integration: Nebius AI Studio

Overview

Integrate with Nebius AI Studio API, which provides access to open-source state-of-the-art large language models (LLMs).

Installation

pip install llama-index-llms-nebius

Usage

Initialization

With environmental variables.

NEBIUS_API_KEY=your_api_key
from llama_index.llms.nebius import NebiusLLM

llm = NebiusLLM(model="meta-llama/Meta-Llama-3.1-70B-Instruct-fast")

Without environmental variables

from llama_index.llms.nebius import NebiusLLM

llm = NebiusLLM(
    api_key="your_api_key", model="meta-llama/Meta-Llama-3.1-70B-Instruct-fast"
)

Launching

Call complete with a prompt

response = llm.complete("Amsterdam is the capital of ")
print(response)

Call chat with a list of messages

from llama_index.core.llms import ChatMessage

messages = [
    ChatMessage(role="system", content="You are a helpful AI assistant."),
    ChatMessage(
        role="user",
        content="Write a poem about a smart AI robot named Wall-e.",
    ),
]
response = llm.chat(messages)
print(response)

Stream complete

response = llm.stream_complete("Amsterdam is the capital of ")
for r in response:
    print(r.delta, end="")

Stream chat

from llama_index.core.llms import ChatMessage

messages = [
    ChatMessage(role="system", content="You are a helpful AI assistant."),
    ChatMessage(
        role="user",
        content="Write a poem about a smart AI robot named Wall-e.",
    ),
]
response = llm.stream_chat(messages)
for r in response:
    print(r.delta, end="")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_nebius-0.2.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_nebius-0.2.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_nebius-0.2.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c289b6edbe93b29f8e6bdb07c5d353933fef644e4c014df45f0b89692727d934
MD5 10b662e33a411efbcaf515df6063e8e0
BLAKE2b-256 96c928d402454a2abb91f5d1fb3a44fff04fc0c23b2fca5780c91b83cb31d294

See more details on using hashes here.

File details

Details for the file llama_index_llms_nebius-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 918a0ef6eca7f9f31541b706ec74f4c443e640d54978bcd2ed7d8fff3edc4b0b
MD5 2848dd392de6d0a7591dc6415b7cf04b
BLAKE2b-256 7da3212961e22f021a239c61c178f6c81c58f9c10af6ee0d62b3af05bf3076ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page