Skip to main content

LlamaIndex Llms Integration: Everlyai

Installation

  1. Install the required Python packages:

    %pip install llama-index-llms-everlyai
    !pip install llama-index
    
  2. Set the EverlyAI API key as an environment variable or pass it directly to the constructor:

    import os
    
    os.environ["EVERLYAI_API_KEY"] = "<your-api-key>"
    

    Or use it directly in your Python code:

    llm = EverlyAI(api_key="your-api-key")
    

Usage

Basic Chat

To send a message and get a response (e.g., a joke):

from llama_index.llms.everlyai import EverlyAI
from llama_index.core.llms import ChatMessage

# Initialize EverlyAI with API key
llm = EverlyAI(api_key="your-api-key")

# Create a message
message = ChatMessage(role="user", content="Tell me a joke")

# Call the chat method
resp = llm.chat([message])
print(resp)

Example output:

Why don't scientists trust atoms?
Because they make up everything!

Streamed Chat

To stream a response for more dynamic conversations (e.g., storytelling):

message = ChatMessage(role="user", content="Tell me a story in 250 words")
resp = llm.stream_chat([message])

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

Example output (partial):

As the sun set over the horizon, a young girl named Lily sat on the beach, watching the waves roll in...

Complete Tasks

To use the complete method for simpler tasks like telling a joke:

resp = llm.complete("Tell me a joke")
print(resp)

Example output:

Why don't scientists trust atoms?
Because they make up everything!

Streamed Completion

For generating responses like stories using stream_complete:

resp = llm.stream_complete("Tell me a story in 250 words")

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

Example output (partial):

As the sun set over the horizon, a young girl named Maria sat on the beach, watching the waves roll in...

Notes

  • Ensure the API key is set correctly before making any requests.
  • The stream_chat and stream_complete methods allow for real-time response streaming, making them ideal for dynamic and lengthy outputs like stories.

LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/everlyai/

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_everlyai-0.6.0.tar.gz (5.0 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_everlyai-0.6.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_everlyai-0.6.0.tar.gz.

File metadata

  • Download URL: llama_index_llms_everlyai-0.6.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_everlyai-0.6.0.tar.gz
Algorithm Hash digest
SHA256 45e84b02175f3278832579db72b33a56c75dbf82189c57d0beead96a56a2917d
MD5 29d8f0091dfa5ede6df5553460ce735b
BLAKE2b-256 af322d02fd226914f761e0ef10e3f96e3cb1565d3f1336d918e214a911fa86c9

See more details on using hashes here.

File details

Details for the file llama_index_llms_everlyai-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_llms_everlyai-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_everlyai-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a86b4697b3600ba2a10903ffbefac621e138e3f1548ff123a9f390b55a427d13
MD5 3d22f701d1b87aa42d6f0ebc69ece40a
BLAKE2b-256 bc93e371fc9f17547f3ce5f741a7a1761ea079931d68ca7edba02015f9b12ad0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

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