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.1.0.tar.gz (2.4 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.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_llms_nebius-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for llama_index_llms_nebius-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2999cd02d6d7b2fb96de1565f02a8ae98526cd45d7bcf999fb8c7e56d2400428
MD5 35bd11dc5690430ab72eea7cee2434f5
BLAKE2b-256 a0c3301f4eb11d588cdde110d27541817f9cb878cc083c8494ecf9546e46d7c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f99814ae1aed505cb2dd56c1b00b7438f40f55fb374a95372980ddd574c49aa1
MD5 3acf4d16866a38b35aae1442519dec5e
BLAKE2b-256 5d51a72f9375183d1220d3242caaeb536c483b6c5140a9aaa942dfe5dee36ca5

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