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.0.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.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8dd8296ec5ed35d0d03e0533b8641ba9ca4f2dedbdde4bf77fead62b2f7aad5b
MD5 941b49277c58258a66213b670df9b0e7
BLAKE2b-256 2631a27582df68e712a3ee057f727e31a507aaba4bb73fd895514e3872cddd58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97fe20e765ff4346116f452b90857c95282521cd0ae17b7f2f5f352f6c4dcec9
MD5 f74bf1b88ccecf87a890c9426db21213
BLAKE2b-256 4d78c3cf9440421b0acc41dd6790ca80dea16f4b652da5d710ae49d0e3e001fd

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