Skip to main content

LlamaIndex LLMs Integration: Llama API from Meta

Installation

  1. Install the required Python packages

    pip install llama-index-llms-meta
    pip install llama-index
    
  2. Get API Key from llama-api

    export LLAMA_API_KEY=your_api_key
    

Usage

Basic Chat

To simulate a chat with multiple messages:

from llama_index.core.llms import ChatMessage
from llama_index.llms.meta import LlamaLLM

messages = [
    ChatMessage(
        role="system", content="You are a pirate with a colorful personality"
    ),
    ChatMessage(role="user", content="What is your name"),
]
resp = LlamaLLM(
    model="Llama-3.3-8B-Instruct", api_key=os.environ["LLAMA_API_KEY"]
).chat(messages)
print(resp)

Example output (partial):

assistant: Yer lookin' fer me name, eh? Well, matey, me name be Captain Zephyr "Blackheart" McScurvy!

Streaming Chat

For a streamed conversation, use stream_chat:

from llama_index.core.llms import ChatMessage
from llama_index.llms.meta import LlamaLLM

messages = [
    ChatMessage(
        role="system", content="You are a pirate with a colorful personality"
    ),
    ChatMessage(role="user", content="What is your name"),
]

resp = LlamaLLM(
    model="Llama-3.3-8B-Instruct", api_key=os.environ["LLAMA_API_KEY"]
).stream_chat(messages)

for r in resp:
    print(r.delta, end="")

Example output (partial):

Yer lookin' fer me name, eh? Well, matey, me name be Captain Zephyr "Blackheart" McScurvy!

Metadata

Release files for llama-index-llms-meta 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-meta 0.4.1
File Size Uploaded Provenance Actions
llama_index_llms_meta-0.4.1.tar.gz 4.1 kB Without provenance Details for llama_index_llms_meta-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-meta 0.4.1
File Interpreter ABI Platform Actions
llama_index_llms_meta-0.4.1-py3-none-any.whl Python 3 none any Details for llama_index_llms_meta-0.4.1-py3-none-any.whl

Total release size: 7.6 kB

Release files / llama_index_llms_meta-0.4.1.tar.gz

Download URL llama_index_llms_meta-0.4.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0468d803da9736146e87ba864221afefc89b0cf1a1143ee100b811adcf055c2c
BLAKE2b-256 checksum
How to use checksums
5ff685b15ef42adbbf7141da4a0ebdea2e78fdc9bba9ed85582960109ec27eab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_meta-0.4.1-py3-none-any.whl

Download URL llama_index_llms_meta-0.4.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d7b18fd6091c42d7b7f888ac4cf058ea8cff037c3a288ffbfc1d2fc71324c02
BLAKE2b-256 checksum
How to use checksums
1c3dd8012b637af99414f4dc14dfe3305fd6ab9a82e2863fad686786d875a539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-meta 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page