Metadata-Version: 2.1
Name: openplayground-api
Version: 0.0.1
Summary:  A reverse engineered API wrapper for OpenPlayground (nat.dev)
Home-page: https://github.com/ading2210/openplayground-api
Author: ading2210
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# Python OpenPlayground API
This is an unoffical API wrapper for the website [OpenPlayground](https://nat.dev).

## Features:
This library has the following abilities:
 - List models
 - Generate text

## Documentation:
An example of how to use this library can be found in `/examples/example.py`.

### The `Model` Class:
The `openplayground.Model` class describes a model that is available to the user. Valid attributes are:
 - `provider` - The company that developed the model (e.g., openai, anthropic)
 - `name` - The name of the model, such as `text-davinci-003`.
 - `version` - The version of the model. This may return `None` on some models.
 - `tag` - A string that combines the provider and name in this format: `<provider>:<name>`. Example: `openai:text-davinci-003`
 - `params` - A dictionary containing possible parameters for the model.

### Initializing the Client:
The `openplayground.Client` class accepts one argument, which is your account's token. Your token can be obtained from the `__session` field in your browser's cookies.

### Downloading the Available Models:
The `openplayground.Client.get_models` function fetches the available models from `https://nat.dev/api/all_models`, and returns a dictionary of `openplayground.Model` objects.

### Generating Text:
The `openplayground.Client.generate` function generates some text given a model and a prompt. Optionally, you can also specify arguments such as the maximum length in the kwargs. You can find a list of valid arguments and their defaults in `openplayground.Model.params`. A few common ones are:
 - `maximum_length`
 - `temperature`
 - `top_k`
 - `top_p`

The values returned from this function are streamed and expressed in a dictionary.

## Copyright:
This project is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt). All code has been written by me, [ading2210](https://github.com/ading2210).
