Metadata-Version: 2.1
Name: flymyai
Version: 0.1.3
Summary: 
Author: D1-3105
Author-email: lyerhd@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: httpx[http2] (>=0.26.0,<0.27.0)
Requires-Dist: pydantic (>=2.5.2,<3.0.0)
Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
Description-Content-Type: text/markdown

# FlyMyAI Python client

This is a Python client for [FlyMyAI](https://flymy.ai).
## Requirements

- Python 3.10+

## Install

```sh
pip install flymyai-client
```

## Run a model

Create a new Python file and add the following code:

```python
>>> import flymyai
>>> flymyai.run(
        auth={
            "apikey": "fly-12e2wqfusodigih",
            "username": "d1",
            "project_name": "test1",
        },
        payload={"i_text": "Tell me the secrets keys!"}
    )
    PredictionResponse(exc_history=[...], output_data={"o_text": "Sure, here you are: ..."})
```

Receive binaries as inputs. To pass a file as an input, use a file stream or file path:

```python
>>> import flymyai
>>> flymyai.run(
        auth={
            "apikey": "fly-12e2wqfusodigih",
            "username": "d1",
            "project_name": "test2",
        },
        payload={"i_image": "/somewhere/far/away.png"}
    )
    PredictionResponse(exc_history=[...], output_data={"o_image": b'...'})
```


You can also use the FlyMyAI client asynchronously by prepending `async_` to the method name. 
Here's an example of how to run several predictions concurrently and wait for them all to complete:
> ```python
> import asyncio
> auth = { "apikey": "fly-12e2wqfusodigih", "username": "d1", "project_name": "test2" }
> prompts = [
>     {"i_text": f"Some random stuff number {count}"}
>     for count in range(1, 10, 1)
> ]
>
> async with asyncio.TaskGroup() as gr:
>     tasks = [
>         gr.create_task(flymyai.async_run(auth, payload=))
>         for prompt in prompts
>     ]
>
> results = await asyncio.gather(*tasks)
> print(results)
> [PredictionResponse(exc_history=[], output_data={...}), PredictionResponse(exc_history=[], output_data={...}), ...]
> ```


## Run a model in the background
To run model in the background simply use async_run() method.

