Metadata-Version: 2.1
Name: tonic-api
Version: 2.1.0
Summary: Wrappers around the Tonic.ai API
Home-page: https://www.tonic.ai/
License: MIT
Keywords: tonic.ai,tonic
Author: Eric Timmerman
Author-email: eric@tonic.ai
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: more-itertools (>=8.6.0,<9.0.0)
Requires-Dist: pandas (>=1.0.0,<2.0.0)
Requires-Dist: requests (>=2.23.0,<3.0.0)
Description-Content-Type: text/markdown

# Overview
This library contains useful wrappers around the Tonic.ai API.

## Usage

Instantiate the API wrapper using the following code:

```
from tonic_api.api import TonicApi

# Do not include trailing backslash in TONIC_URL
api = TonicApi(TONIC_URL, API_KEY)
```

Once instantiated, the following endpoints are available for consumption. Note that available endpoints and response types are limited. Available fields may be severely limited compared to the current Tonic API.

```
TonicApi:
    get_workspace(workspace_id) => Workspace

Workspace:
    id => string
    name => string
    models => Model[]

    train(model_id) => new job ID
    get_trained_model_by_training_job_id(job_id) => TrainedModel (or None if training is not done)
    get_training_status_by_training_job_id(job_id) => TrainingJobStatus
    get_most_recent_trained_model_by_model_id => TrainedModel

    describe() => debugger helper for printing fields

Model:
    id => string
    name => string
    query => string
    parameters => {}
    encodings => {}

    describe() => debugger helper for printing fields

TrainedModel:
    id => string
    job_id => string
    model => Model

    sample(num_rows) => pandas DataFrame (defaults to 1 row if num_rows not provided)
    sample_source(num_rows) => pandas DataFrame (defaults to 1 row if num_rows not provided). Note: NOT randomized. Upper limit is limited to row count in source.

    get_numeric_columns() => string[]
    get_categorical_columns() => string[]

    describe() => debugger helper for printing fields

TrainingJobStatus:
    state => string
    error => string[] or None
    tasks => {}

    current_epoch_progress() => dict or None

    describe() => debugger helper for printing fields
```

