Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http API wrapper #2

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Add http API wrapper #2

merged 1 commit into from
Sep 4, 2024

Conversation

augray
Copy link
Member

@augray augray commented Aug 29, 2024

Add a wrapper of our HTTP API for the rest of the SDK to use.

Testing

In addition to the unit tests, tested with the following driver code while pointing at the dev Airtrain deployment (remember, sdk users will NOT be using this API directly; this is just to test the wrapper):

import io

import pyarrow.json as jsonl
import pyarrow.parquet as pq

from airtrain.client import client


def main() -> None:
    json_buffer = io.BytesIO()
    json_buffer.write(b'{"text": "hello"}\n')
    json_buffer.write(b'{"text": "world"}')
    json_buffer.seek(0)

    parquet_buffer = io.BytesIO()
    table = jsonl.read_json(json_buffer)
    pq.write_table(table, parquet_buffer)
    response = client().create_dataset(name="From API Client", embedding_column_name=None)

    parquet_buffer.seek(0)
    client().upload_dataset_data(response.dataset_id, parquet_buffer)

    ingest_response = client().trigger_dataset_ingest(response.dataset_id)

    print(
        f"Created dataset {response.dataset_id} "
        f"with ingest job {ingest_response.ingest_job_id}"
    )


if __name__ == "__main__":
    main()

Base automatically changed from augray/boilerplate to main August 30, 2024 20:35
Add py 3.12 custom condition

Add py 3.12 custom condition

Add py 3.12 custom condition for numpy

add proper numpy version deps

resize CI badge

Add release targets

fix typo

simple driver working

Add tests

lint

dedupe README
@augray augray merged commit 877f90d into main Sep 4, 2024
5 checks passed
@augray augray deleted the augray/client branch September 4, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants