Name | llama-index-llms-everlyai JSON |
Version |
0.4.1
JSON |
| download |
home_page | None |
Summary | llama-index llms everlyai integration |
upload_time | 2025-09-08 20:50:22 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.9 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LlamaIndex Llms Integration: Everlyai
## Installation
1. Install the required Python packages:
```bash
%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:
```python
import os
os.environ["EVERLYAI_API_KEY"] = "<your-api-key>"
```
Or use it directly in your Python code:
```python
llm = EverlyAI(api_key="your-api-key")
```
## Usage
### Basic Chat
To send a message and get a response (e.g., a joke):
```python
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):
```python
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:
```python
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`:
```python
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/
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-llms-everlyai",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Your Name <you@example.com>",
"download_url": "https://files.pythonhosted.org/packages/11/96/7707a76d3baeb493e9387de4496a60ea4dcfbc2f25b649770e735e1e1e75/llama_index_llms_everlyai-0.4.1.tar.gz",
"platform": null,
"description": "# LlamaIndex Llms Integration: Everlyai\n\n## Installation\n\n1. Install the required Python packages:\n\n ```bash\n %pip install llama-index-llms-everlyai\n !pip install llama-index\n ```\n\n2. Set the EverlyAI API key as an environment variable or pass it directly to the constructor:\n\n ```python\n import os\n\n os.environ[\"EVERLYAI_API_KEY\"] = \"<your-api-key>\"\n ```\n\n Or use it directly in your Python code:\n\n ```python\n llm = EverlyAI(api_key=\"your-api-key\")\n ```\n\n## Usage\n\n### Basic Chat\n\nTo send a message and get a response (e.g., a joke):\n\n```python\nfrom llama_index.llms.everlyai import EverlyAI\nfrom llama_index.core.llms import ChatMessage\n\n# Initialize EverlyAI with API key\nllm = EverlyAI(api_key=\"your-api-key\")\n\n# Create a message\nmessage = ChatMessage(role=\"user\", content=\"Tell me a joke\")\n\n# Call the chat method\nresp = llm.chat([message])\nprint(resp)\n```\n\nExample output:\n\n```\nWhy don't scientists trust atoms?\nBecause they make up everything!\n```\n\n### Streamed Chat\n\nTo stream a response for more dynamic conversations (e.g., storytelling):\n\n```python\nmessage = ChatMessage(role=\"user\", content=\"Tell me a story in 250 words\")\nresp = llm.stream_chat([message])\n\nfor r in resp:\n print(r.delta, end=\"\")\n```\n\nExample output (partial):\n\n```\nAs the sun set over the horizon, a young girl named Lily sat on the beach, watching the waves roll in...\n```\n\n### Complete Tasks\n\nTo use the `complete` method for simpler tasks like telling a joke:\n\n```python\nresp = llm.complete(\"Tell me a joke\")\nprint(resp)\n```\n\nExample output:\n\n```\nWhy don't scientists trust atoms?\nBecause they make up everything!\n```\n\n### Streamed Completion\n\nFor generating responses like stories using `stream_complete`:\n\n```python\nresp = llm.stream_complete(\"Tell me a story in 250 words\")\n\nfor r in resp:\n print(r.delta, end=\"\")\n```\n\nExample output (partial):\n\n```\nAs the sun set over the horizon, a young girl named Maria sat on the beach, watching the waves roll in...\n```\n\n## Notes\n\n- Ensure the API key is set correctly before making any requests.\n- The `stream_chat` and `stream_complete` methods allow for real-time response streaming, making them ideal for dynamic and lengthy outputs like stories.\n\n### LLM Implementation example\n\nhttps://docs.llamaindex.ai/en/stable/examples/llm/everlyai/\n",
"bugtrack_url": null,
"license": null,
"summary": "llama-index llms everlyai integration",
"version": "0.4.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5ebcfd0a3a3d0119b3eaebd39256a1d7f070cf9f87105387de00a827f35d8436",
"md5": "8f6b64c25f04cb143cac71b9501a63f7",
"sha256": "1274a0d5640c6832c27779094db4530b30e95cf0c786bcfcad36381d7014aa1b"
},
"downloads": -1,
"filename": "llama_index_llms_everlyai-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8f6b64c25f04cb143cac71b9501a63f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4925,
"upload_time": "2025-09-08T20:50:21",
"upload_time_iso_8601": "2025-09-08T20:50:21.398893Z",
"url": "https://files.pythonhosted.org/packages/5e/bc/fd0a3a3d0119b3eaebd39256a1d7f070cf9f87105387de00a827f35d8436/llama_index_llms_everlyai-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "11967707a76d3baeb493e9387de4496a60ea4dcfbc2f25b649770e735e1e1e75",
"md5": "66e5dcd84856460f7b5090dc2c66838e",
"sha256": "e16c2ed9d4b657d5739ccb6e538cc5e292c0e22afd64b59843865314284b123b"
},
"downloads": -1,
"filename": "llama_index_llms_everlyai-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "66e5dcd84856460f7b5090dc2c66838e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5049,
"upload_time": "2025-09-08T20:50:22",
"upload_time_iso_8601": "2025-09-08T20:50:22.108797Z",
"url": "https://files.pythonhosted.org/packages/11/96/7707a76d3baeb493e9387de4496a60ea4dcfbc2f25b649770e735e1e1e75/llama_index_llms_everlyai-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 20:50:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-llms-everlyai"
}