Metadata-Version: 2.1
Name: fireworks-ai
Version: 0.3.0
Summary: Python client library for the Fireworks.ai Generative AI Platform
Author-email: Fireworks AI <info@fireworks.ai>
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.
Project-URL: Homepage, https://fireworks.ai
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE

# 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
```

## Example code
### List
```python
import fireworks.client
fireworks.client.api_key = "your-key"
print(fireworks.client.Models.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-v2-7b", "Once upon a time", temperature=0.7, n=2, max_tokens=16)
print(completion)
```

```
id='cmpl-988e179fa14fbaebdf17c713' object='text_completion' created=1691602259 model='accounts/fireworks/models/llama-v2-7b' choices=[Choice(text=', there was an emperor who reigned over all the kingdoms of the', index=0, finish_reason='length'), Choice(text=', a boy lived in a small house with his mom and dad. His', index=1, finish_reason='length')]
```

### 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-v2-7b", "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
```


## Requirements

- Python 3.9
