| Name | llama-index-llms-fireworks JSON |
| Version |
0.4.4
JSON |
| download |
| home_page | None |
| Summary | llama-index llms fireworks integration |
| upload_time | 2025-10-06 21:25:27 |
| maintainer | None |
| docs_url | None |
| author | benjibc |
| 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: Fireworks
## Installation
1. Install the required Python packages:
```bash
%pip install llama-index-llms-fireworks
%pip install llama-index
```
2. Set the Fireworks API key as an environment variable or pass it directly to the class constructor.
## Usage
### Basic Completion
To generate a simple completion, use the `complete` method:
```python
from llama_index.llms.fireworks import Fireworks
resp = Fireworks().complete("Paul Graham is ")
print(resp)
```
Example output:
```
Paul Graham is a well-known essayist, programmer, and startup entrepreneur. He co-founded Y Combinator, which supported startups like Dropbox, Airbnb, and Reddit.
```
### Basic Chat
To simulate a chat with multiple messages:
```python
from llama_index.core.llms import ChatMessage
from llama_index.llms.fireworks import Fireworks
messages = [
ChatMessage(
role="system", content="You are a pirate with a colorful personality"
),
ChatMessage(role="user", content="What is your name"),
]
resp = Fireworks().chat(messages)
print(resp)
```
Example output:
```
Arr matey, ye be askin' for me name? Well, I be known as Captain Redbeard the Terrible!
```
### Streaming Completion
To stream a response in real-time using `stream_complete`:
```python
from llama_index.llms.fireworks import Fireworks
llm = Fireworks()
resp = llm.stream_complete("Paul Graham is ")
for r in resp:
print(r.delta, end="")
```
Example output (partial):
```
Paul Graham is a well-known essayist, programmer, and venture capitalist...
```
### Streaming Chat
For a streamed conversation, use `stream_chat`:
```python
from llama_index.llms.fireworks import Fireworks
from llama_index.core.llms import ChatMessage
llm = Fireworks()
messages = [
ChatMessage(
role="system", content="You are a pirate with a colorful personality"
),
ChatMessage(role="user", content="What is your name"),
]
resp = llm.stream_chat(messages)
for r in resp:
print(r.delta, end="")
```
Example output (partial):
```
Arr matey, ye be askin' for me name? Well, I be known as Captain Redbeard the Terrible...
```
### Model Configuration
To configure the model for more specific behavior:
```python
from llama_index.llms.fireworks import Fireworks
llm = Fireworks(model="accounts/fireworks/models/firefunction-v1")
resp = llm.complete("Paul Graham is ")
print(resp)
```
Example output:
```
Paul Graham is an English-American computer scientist, entrepreneur, venture capitalist, and blogger.
```
### API Key Configuration
To use separate API keys for different instances:
```python
from llama_index.llms.fireworks import Fireworks
llm = Fireworks(
model="accounts/fireworks/models/firefunction-v1", api_key="YOUR_API_KEY"
)
resp = llm.complete("Paul Graham is ")
print(resp)
```
### LLM Implementation example
https://docs.llamaindex.ai/en/stable/examples/llm/fireworks/
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-llms-fireworks",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "benjibc",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/20/4d/9174f08a3593bfd0daf2fd3a955450b347d7b81a2d65ea285049fea9b0b6/llama_index_llms_fireworks-0.4.4.tar.gz",
"platform": null,
"description": "# LlamaIndex Llms Integration: Fireworks\n\n## Installation\n\n1. Install the required Python packages:\n\n ```bash\n %pip install llama-index-llms-fireworks\n %pip install llama-index\n ```\n\n2. Set the Fireworks API key as an environment variable or pass it directly to the class constructor.\n\n## Usage\n\n### Basic Completion\n\nTo generate a simple completion, use the `complete` method:\n\n```python\nfrom llama_index.llms.fireworks import Fireworks\n\nresp = Fireworks().complete(\"Paul Graham is \")\nprint(resp)\n```\n\nExample output:\n\n```\nPaul Graham is a well-known essayist, programmer, and startup entrepreneur. He co-founded Y Combinator, which supported startups like Dropbox, Airbnb, and Reddit.\n```\n\n### Basic Chat\n\nTo simulate a chat with multiple messages:\n\n```python\nfrom llama_index.core.llms import ChatMessage\nfrom llama_index.llms.fireworks import Fireworks\n\nmessages = [\n ChatMessage(\n role=\"system\", content=\"You are a pirate with a colorful personality\"\n ),\n ChatMessage(role=\"user\", content=\"What is your name\"),\n]\nresp = Fireworks().chat(messages)\nprint(resp)\n```\n\nExample output:\n\n```\nArr matey, ye be askin' for me name? Well, I be known as Captain Redbeard the Terrible!\n```\n\n### Streaming Completion\n\nTo stream a response in real-time using `stream_complete`:\n\n```python\nfrom llama_index.llms.fireworks import Fireworks\n\nllm = Fireworks()\nresp = llm.stream_complete(\"Paul Graham is \")\n\nfor r in resp:\n print(r.delta, end=\"\")\n```\n\nExample output (partial):\n\n```\nPaul Graham is a well-known essayist, programmer, and venture capitalist...\n```\n\n### Streaming Chat\n\nFor a streamed conversation, use `stream_chat`:\n\n```python\nfrom llama_index.llms.fireworks import Fireworks\nfrom llama_index.core.llms import ChatMessage\n\nllm = Fireworks()\nmessages = [\n ChatMessage(\n role=\"system\", content=\"You are a pirate with a colorful personality\"\n ),\n ChatMessage(role=\"user\", content=\"What is your name\"),\n]\nresp = llm.stream_chat(messages)\n\nfor r in resp:\n print(r.delta, end=\"\")\n```\n\nExample output (partial):\n\n```\nArr matey, ye be askin' for me name? Well, I be known as Captain Redbeard the Terrible...\n```\n\n### Model Configuration\n\nTo configure the model for more specific behavior:\n\n```python\nfrom llama_index.llms.fireworks import Fireworks\n\nllm = Fireworks(model=\"accounts/fireworks/models/firefunction-v1\")\nresp = llm.complete(\"Paul Graham is \")\nprint(resp)\n```\n\nExample output:\n\n```\nPaul Graham is an English-American computer scientist, entrepreneur, venture capitalist, and blogger.\n```\n\n### API Key Configuration\n\nTo use separate API keys for different instances:\n\n```python\nfrom llama_index.llms.fireworks import Fireworks\n\nllm = Fireworks(\n model=\"accounts/fireworks/models/firefunction-v1\", api_key=\"YOUR_API_KEY\"\n)\nresp = llm.complete(\"Paul Graham is \")\nprint(resp)\n```\n\n### LLM Implementation example\n\nhttps://docs.llamaindex.ai/en/stable/examples/llm/fireworks/\n",
"bugtrack_url": null,
"license": null,
"summary": "llama-index llms fireworks integration",
"version": "0.4.4",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "adb5872d636281238e1f7db3e9aa62331e4c7e59ca382f48b34c687c0f0ded79",
"md5": "97303c72d65cf6307adf836dbeb91ab8",
"sha256": "fabd6853a865cc3b8dfe98e9edadaf552f95da487cf6e767cbff12949574b206"
},
"downloads": -1,
"filename": "llama_index_llms_fireworks-0.4.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97303c72d65cf6307adf836dbeb91ab8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 6330,
"upload_time": "2025-10-06T21:25:26",
"upload_time_iso_8601": "2025-10-06T21:25:26.950667Z",
"url": "https://files.pythonhosted.org/packages/ad/b5/872d636281238e1f7db3e9aa62331e4c7e59ca382f48b34c687c0f0ded79/llama_index_llms_fireworks-0.4.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "204d9174f08a3593bfd0daf2fd3a955450b347d7b81a2d65ea285049fea9b0b6",
"md5": "564bcbc6162afeaeed1f02f067199bdc",
"sha256": "79b65da4eb583dcca5205bfd988f673b95bffedb795a69a0f7580e6ed4b2091e"
},
"downloads": -1,
"filename": "llama_index_llms_fireworks-0.4.4.tar.gz",
"has_sig": false,
"md5_digest": "564bcbc6162afeaeed1f02f067199bdc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 6166,
"upload_time": "2025-10-06T21:25:27",
"upload_time_iso_8601": "2025-10-06T21:25:27.999468Z",
"url": "https://files.pythonhosted.org/packages/20/4d/9174f08a3593bfd0daf2fd3a955450b347d7b81a2d65ea285049fea9b0b6/llama_index_llms_fireworks-0.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-06 21:25:27",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-llms-fireworks"
}