Skip to main content

llama-index llms featherlessai integration

Project description

LlamaIndex Llms Integration: Featherless AI

Installation

To install the required package, run:

pip install llama-index-llms-featherlessai

Setup

  1. Set your Featherless AI API key as an environment variable. Visit https://www.featherless.ai/ and sign up to get an API key.
import os

os.environ["FEATHERLESS_API_KEY"] = "you_api_key"

Basic Usage

Generate Completions

from llama_index.llms.featherlessai import FeatherlessLLM

llm = FeatherlessLLM(
    model="meta-llama/Llama-3.3-70B-Instruct", api_key="your api key"
)

resp = llm.complete("Is 9.9 or 9.11 bigger?")
print(resp)

Chat Responses

To send a chat message and receive a response, create a list of ChatMessage instances and use the chat method:

from llama_index.core.llms import ChatMessage

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

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_featherlessai-0.1.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.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_featherlessai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 552a0acec33efe311fee02946e550455b30c6fa1eccee096f4e8e77f351a66e4
MD5 96eaabe1797e4de20e5e8480b9a8e8bc
BLAKE2b-256 f04ba1da3117461d5a29d2738713c5945292fe17965001f769f2a0120414aed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_featherlessai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7a1d8d7b8f110a5b3eb47d2141abc816eaa3da4859ba041e4f679f193c0874
MD5 e2336e56e8eacb351c587787387354ee
BLAKE2b-256 fd326414b700f674e9c28ab7d69a059ab5c3348e9533b7f92e3bf8a9edc51ca3

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