Name | fireworks-ai JSON |
Version |
0.15.10
JSON |
| download |
home_page | None |
Summary | Python client library for the Fireworks.ai Generative AI Platform |
upload_time | 2024-12-06 22:03:35 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | The MIT License Copyright (c) Fireworks (https://fireworks.ai) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Fireworks.ai Python library
Fireworks.ai Python Library provides a convenient API for accessing Fireworks supported LLMs. We are targeting our API to be very similar to OpenAI's API so you can replace OpenAI usage with minimal modifications
## Installation
```sh
pip install --upgrade fireworks-ai
```
## API definitions
Please check our [completion](https://fireworksai.readme.io/reference/createchatcompletion) and [chat completion](https://fireworksai.readme.io/reference/createcompletion) API reference for the arguments we support and the meaning of each arguments.
## Example code
### List
```python
import fireworks.client
fireworks.client.api_key = "your-key"
print(fireworks.client.Model.list())
```
```
object='list' data=[Model(id="accounts/fireworks/models/llama-v2-7b", object="model", created=0), ...]
```
### Completion
```python
import fireworks.client
fireworks.client.api_key = "your-key"
completion = fireworks.client.Completion.create("accounts/fireworks/models/llama-v3-8b-instruct", "Once upon a time", temperature=0.1, n=2, max_tokens=16)
print(completion)
```
```
id='8bd3ac8f-a7d3-4dab-a19e-cea3f9c83f1e' object='text_completion' created=1714831539 model='accounts/fireworks/models/llama-v3-8b-instruct' choices=[Choice(index=0, text=', there was a young girl named Sophia who lived in a small village surrounded by', logprobs=None, finish_reason='length', raw_output=None), Choice(index=1, text=', there was a small village nestled in the heart of a dense forest. The', logprobs=None, finish_reason='length', raw_output=None)] usage=UsageInfo(prompt_tokens=4, total_tokens=36, completion_tokens=32)
```
### Streaming completion
```python
import fireworks.client
fireworks.client.api_key = "your-key"
for completion in fireworks.client.Completion.create(
"accounts/fireworks/models/llama-v3-8b-instruct",
prompt="Once upon a time",
temperature=0.1,
n=2,
max_tokens=16
):
print(completion)
```
### Async completion
```python
import asyncio
import fireworks.client
fireworks.client.api_key = "your-key"
async def main():
response = await fireworks.client.Completion.acreate("accounts/fireworks/models/llama-v3-8b-instruct", "Once upon a time", echo=True, max_tokens=16)
print(response.choices[0].text)
asyncio.run(main())
```
then run the script
```
$ python test.py
Once upon a time, there used to be a huge mountain that was the most famous mou
```
### ChatCompletion
```python
import fireworks.client
fireworks.client.api_key = "your-key"
completion = fireworks.client.ChatCompletion.create(
"accounts/fireworks/models/llama-v3-8b-instruct",
messages=[{"role": "user", "content": "Hello there!"}],
temperature=0.7,
n=2,
max_tokens=16
)
print(completion)
```
```
id='cmpl-ec241c8f5b8d50bcf792f2df' object='chat.completion' created=1691896960 model='accounts/fireworks/models/llama-v2-7b-chat' choices=[ChatCompletionResponseChoice(index=0, message=ChatMessage(role='assistant', content=" Hello! It's nice to meet you. Is there something I can"), finish_reason='length'), ChatCompletionResponseChoice(index=1, message=ChatMessage(role='assistant', content=" Hello! It's nice to meet you. Is there something I can"), finish_reason='length')] usage=UsageInfo(prompt_tokens=23, total_tokens=55, completion_tokens=32)
```
## Requirements
- Python 3.7
Raw data
{
"_id": null,
"home_page": null,
"name": "fireworks-ai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Fireworks AI <info@fireworks.ai>",
"download_url": "https://files.pythonhosted.org/packages/80/d9/7204d20f17684f85a920a42f7b2c463bbefef833b56e7d4ec04c612880c1/fireworks_ai-0.15.10.tar.gz",
"platform": null,
"description": "# Fireworks.ai Python library\n\nFireworks.ai Python Library provides a convenient API for accessing Fireworks supported LLMs. We are targeting our API to be very similar to OpenAI's API so you can replace OpenAI usage with minimal modifications\n\n## Installation\n\n```sh\npip install --upgrade fireworks-ai\n```\n\n## API definitions\nPlease check our [completion](https://fireworksai.readme.io/reference/createchatcompletion) and [chat completion](https://fireworksai.readme.io/reference/createcompletion) API reference for the arguments we support and the meaning of each arguments.\n\n## Example code\n\n### List\n\n```python\nimport fireworks.client\nfireworks.client.api_key = \"your-key\"\nprint(fireworks.client.Model.list())\n```\n\n```\nobject='list' data=[Model(id=\"accounts/fireworks/models/llama-v2-7b\", object=\"model\", created=0), ...]\n```\n\n### Completion\n\n```python\nimport fireworks.client\nfireworks.client.api_key = \"your-key\"\ncompletion = fireworks.client.Completion.create(\"accounts/fireworks/models/llama-v3-8b-instruct\", \"Once upon a time\", temperature=0.1, n=2, max_tokens=16)\nprint(completion)\n```\n\n```\nid='8bd3ac8f-a7d3-4dab-a19e-cea3f9c83f1e' object='text_completion' created=1714831539 model='accounts/fireworks/models/llama-v3-8b-instruct' choices=[Choice(index=0, text=', there was a young girl named Sophia who lived in a small village surrounded by', logprobs=None, finish_reason='length', raw_output=None), Choice(index=1, text=', there was a small village nestled in the heart of a dense forest. The', logprobs=None, finish_reason='length', raw_output=None)] usage=UsageInfo(prompt_tokens=4, total_tokens=36, completion_tokens=32)\n```\n\n### Streaming completion\n\n```python\nimport fireworks.client\nfireworks.client.api_key = \"your-key\"\nfor completion in fireworks.client.Completion.create(\n \"accounts/fireworks/models/llama-v3-8b-instruct\",\n prompt=\"Once upon a time\",\n temperature=0.1,\n n=2,\n max_tokens=16\n):\n print(completion)\n```\n\n\n### Async completion\n\n```python\nimport asyncio\nimport fireworks.client\nfireworks.client.api_key = \"your-key\"\nasync def main():\n response = await fireworks.client.Completion.acreate(\"accounts/fireworks/models/llama-v3-8b-instruct\", \"Once upon a time\", echo=True, max_tokens=16)\n print(response.choices[0].text)\nasyncio.run(main())\n```\n\nthen run the script\n\n```\n$ python test.py\nOnce upon a time, there used to be a huge mountain that was the most famous mou\n```\n\n### ChatCompletion\n\n```python\nimport fireworks.client\nfireworks.client.api_key = \"your-key\"\ncompletion = fireworks.client.ChatCompletion.create(\n \"accounts/fireworks/models/llama-v3-8b-instruct\",\n messages=[{\"role\": \"user\", \"content\": \"Hello there!\"}],\n temperature=0.7,\n n=2,\n max_tokens=16\n)\nprint(completion)\n```\n\n```\nid='cmpl-ec241c8f5b8d50bcf792f2df' object='chat.completion' created=1691896960 model='accounts/fireworks/models/llama-v2-7b-chat' choices=[ChatCompletionResponseChoice(index=0, message=ChatMessage(role='assistant', content=\" Hello! It's nice to meet you. Is there something I can\"), finish_reason='length'), ChatCompletionResponseChoice(index=1, message=ChatMessage(role='assistant', content=\" Hello! It's nice to meet you. Is there something I can\"), finish_reason='length')] usage=UsageInfo(prompt_tokens=23, total_tokens=55, completion_tokens=32)\n```\n\n## Requirements\n\n- Python 3.7\n",
"bugtrack_url": null,
"license": "The MIT License Copyright (c) Fireworks (https://fireworks.ai) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Python client library for the Fireworks.ai Generative AI Platform",
"version": "0.15.10",
"project_urls": {
"Homepage": "https://fireworks.ai"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c796401d848b50c6ed41703a400d761b67fd3256b613daaeeaeb330099ab3704",
"md5": "8c4a051bf9584f477d3e7128e963348d",
"sha256": "5754ab9c730d568e76407cc2274284bce115ae2d377c4d8c5f2f758e7eba1d37"
},
"downloads": -1,
"filename": "fireworks_ai-0.15.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8c4a051bf9584f477d3e7128e963348d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 111645,
"upload_time": "2024-12-06T22:03:33",
"upload_time_iso_8601": "2024-12-06T22:03:33.001529Z",
"url": "https://files.pythonhosted.org/packages/c7/96/401d848b50c6ed41703a400d761b67fd3256b613daaeeaeb330099ab3704/fireworks_ai-0.15.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "80d97204d20f17684f85a920a42f7b2c463bbefef833b56e7d4ec04c612880c1",
"md5": "7f6193e007fded67b7cb0b37d393db65",
"sha256": "2b4e7c691d40370c31e99e4ab0d493090d7b5bcb11ff4cda56a2db9059485bc2"
},
"downloads": -1,
"filename": "fireworks_ai-0.15.10.tar.gz",
"has_sig": false,
"md5_digest": "7f6193e007fded67b7cb0b37d393db65",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 90336,
"upload_time": "2024-12-06T22:03:35",
"upload_time_iso_8601": "2024-12-06T22:03:35.233296Z",
"url": "https://files.pythonhosted.org/packages/80/d9/7204d20f17684f85a920a42f7b2c463bbefef833b56e7d4ec04c612880c1/fireworks_ai-0.15.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 22:03:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fireworks-ai"
}