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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_llms_nebius-0.0.1.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.0.1.tar.gz
Algorithm Hash digest
SHA256 3ec465398633c4cdb04b8739ca338658354748e0dd8b1dc141653196f932b079
MD5 bc1054fffe72d98e321a43ed64c81212
BLAKE2b-256 096275b6d911e41eed683a964c73a86e4c93b3118a2dc265366d52e4ee31ad20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_nebius-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d36299d20b89481257e4374cdb4b0a90a65cb49b000e2572d5f75b1edbc11188
MD5 770d3f926efc170aa5fc44740d9d1239
BLAKE2b-256 c08ef1ed623de3cae7df6639b0d8c84c83595afd695aa8fc0ce1ffa5475576a0

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