Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
26c2b5e
Started image upload implementation
mikelam-us-aixplain Jul 27, 2023
1d17a54
Adding create_asset
mikelam-us-aixplain Aug 9, 2023
882ba6d
Adding CLI
mikelam-us-aixplain Aug 14, 2023
e8095d4
classmethod last
mikelam-us-aixplain Aug 14, 2023
04ec84c
Corrected entry point path
mikelam-us-aixplain Aug 14, 2023
1534ff4
Working on entry point path
mikelam-us-aixplain Aug 14, 2023
924b93d
No CLI for now
mikelam-us-aixplain Aug 15, 2023
55d9b7d
Fixed list host post -> get
mikelam-us-aixplain Aug 15, 2023
5af5935
Removed slash from URL
mikelam-us-aixplain Aug 15, 2023
367d27c
Added is async
mikelam-us-aixplain Aug 15, 2023
65dee4d
Adding first functional tests
mikelam-us-aixplain Aug 20, 2023
6c51d81
printing urls
mikelam-us-aixplain Aug 20, 2023
c25bbe9
Corrected test URL
mikelam-us-aixplain Aug 20, 2023
64663e8
Changing url to post
mikelam-us-aixplain Aug 20, 2023
4680573
pulling response correctly
mikelam-us-aixplain Aug 20, 2023
7ed3099
pulling response correctly
mikelam-us-aixplain Aug 20, 2023
6e7fced
to json
mikelam-us-aixplain Aug 20, 2023
de770d9
to json
mikelam-us-aixplain Aug 20, 2023
d8cb963
Create_asset_repo_test
mikelam-us-aixplain Aug 21, 2023
05b3747
create_asset_repo response
mikelam-us-aixplain Aug 21, 2023
c1be93a
dict conversion error
mikelam-us-aixplain Aug 21, 2023
4cd6454
Added list_host_machines test
mikelam-us-aixplain Aug 21, 2023
ba97b6c
corrected test function naem
mikelam-us-aixplain Aug 21, 2023
0e0c9b1
post -> get
mikelam-us-aixplain Aug 21, 2023
d64d9ca
dict conversion
mikelam-us-aixplain Aug 21, 2023
dcc0d7b
Added image_repo_tag test
mikelam-us-aixplain Aug 21, 2023
fc3ca6e
Finished list tags test
mikelam-us-aixplain Aug 21, 2023
7227199
Debugging list tags test
mikelam-us-aixplain Aug 21, 2023
017f4df
Added is_onboarded
mikelam-us-aixplain Aug 21, 2023
bf208f6
Added list_functions function + test
mikelam-us-aixplain Aug 22, 2023
e4d4d2c
e2e image upload testing
mikelam-us-aixplain Aug 25, 2023
26546c8
Updated image upload test
mikelam-us-aixplain Aug 30, 2023
823ece2
Create_asset_repo updated to include source language
mikelam-us-aixplain Sep 5, 2023
fe5d56b
Added comments to model_factory
mikelam-us-aixplain Sep 6, 2023
7920f04
Added logging, minor change to URLs
mikelam-us-aixplain Sep 6, 2023
436d05f
Corrected URL generation
mikelam-us-aixplain Sep 7, 2023
aa45ae9
Removed ID field from host machines
mikelam-us-aixplain Sep 12, 2023
ad5044c
deleting key
mikelam-us-aixplain Sep 12, 2023
b93073b
Corrected json -> dict conversion
mikelam-us-aixplain Sep 12, 2023
b2251d0
Corrected json -> dict conversion again
mikelam-us-aixplain Sep 12, 2023
11e8d5f
Corrected json -> dict conversion again with dict typing
mikelam-us-aixplain Sep 12, 2023
c42fa76
Adding debugging
mikelam-us-aixplain Sep 12, 2023
30a6f92
Corrected for list
mikelam-us-aixplain Sep 12, 2023
ac9ffc7
removed print statements
mikelam-us-aixplain Sep 12, 2023
56534bd
Added 'verbose' option for list_functions
mikelam-us-aixplain Sep 12, 2023
53c5ab3
Function name instead of ID
mikelam-us-aixplain Sep 12, 2023
48d375c
First try at setting environment variables during login
mikelam-us-aixplain Sep 13, 2023
7280d39
Removed 'is_onboarded' from test
mikelam-us-aixplain Sep 13, 2023
de9b29d
Corrected tests
mikelam-us-aixplain Sep 13, 2023
728774e
Testing CLI
mikelam-us-aixplain Sep 14, 2023
cdf560d
Removing circular import
mikelam-us-aixplain Sep 14, 2023
5a7f7af
Trying swapping classmethod decorator
mikelam-us-aixplain Sep 14, 2023
a846961
Experimenting with calls
mikelam-us-aixplain Sep 14, 2023
3d445f8
static method
mikelam-us-aixplain Sep 14, 2023
28f50f4
random stuff
mikelam-us-aixplain Sep 14, 2023
a1a70af
non-classmethod
mikelam-us-aixplain Sep 15, 2023
2ac1b2d
Experimenting with non-classmethod
mikelam-us-aixplain Sep 15, 2023
debe3b1
Experimenting with non-classmethod
mikelam-us-aixplain Sep 15, 2023
d7ddc9f
testing out non-classmethod
mikelam-us-aixplain Sep 15, 2023
a111168
print
mikelam-us-aixplain Sep 15, 2023
2314663
Get another error
mikelam-us-aixplain Sep 15, 2023
b15a15a
Added classmethod decorator
mikelam-us-aixplain Sep 15, 2023
53b3204
Adding __get__
mikelam-us-aixplain Sep 15, 2023
9b72db2
Corrected syntax error
mikelam-us-aixplain Sep 15, 2023
87e124c
Added debugger
mikelam-us-aixplain Sep 15, 2023
8670959
Adding separate cli file
mikelam-us-aixplain Sep 15, 2023
7688b11
Removed unused line
mikelam-us-aixplain Sep 15, 2023
c4b719a
Removed unnecessary decorator
mikelam-us-aixplain Sep 15, 2023
f7e64c0
Adding arguments
mikelam-us-aixplain Sep 15, 2023
a994a40
argument->option
mikelam-us-aixplain Sep 15, 2023
0025c25
Added list_functions cli
mikelam-us-aixplain Sep 15, 2023
129dc29
Added list_functions cli
mikelam-us-aixplain Sep 15, 2023
0fb7630
Fixed function decorator
mikelam-us-aixplain Sep 15, 2023
27d2a49
Finished CLI draft
mikelam-us-aixplain Sep 18, 2023
cdd222c
Removed unnecessary context
mikelam-us-aixplain Sep 18, 2023
34810e8
Experimenting
mikelam-us-aixplain Sep 18, 2023
091a8a3
Refactored directories
mikelam-us-aixplain Sep 18, 2023
8879c2e
Adding debug print statements to create_asset_repo
mikelam-us-aixplain Sep 18, 2023
7f4d2b2
debugging weird function
mikelam-us-aixplain Sep 18, 2023
b76542f
id -> code
mikelam-us-aixplain Sep 18, 2023
d24a942
Removed debugging statements
mikelam-us-aixplain Sep 18, 2023
1cb72e1
Removed unused import
mikelam-us-aixplain Sep 18, 2023
ac56f69
Correcting rudimentary tests
mikelam-us-aixplain Sep 19, 2023
3141d0e
Debugging image upload test
mikelam-us-aixplain Sep 19, 2023
ae18a5b
Working on list_host_machines test
mikelam-us-aixplain Sep 19, 2023
532bc3b
Working on list_host_machines test
mikelam-us-aixplain Sep 19, 2023
99b9df7
Debugging create_asset_repo test
mikelam-us-aixplain Sep 19, 2023
9f5eac4
Debugging image upload test
mikelam-us-aixplain Sep 19, 2023
ed2888c
Corrected function name in test
mikelam-us-aixplain Sep 19, 2023
cb5331c
Corrected ID
mikelam-us-aixplain Sep 19, 2023
9e9b3eb
Corrected test errors
mikelam-us-aixplain Sep 19, 2023
d467a37
Removing 'results' from list_function
mikelam-us-aixplain Sep 19, 2023
08e5437
'mame' -> 'name'
mikelam-us-aixplain Sep 20, 2023
44658ea
Adding pretty-print for list_functions
mikelam-us-aixplain Sep 20, 2023
bc14db8
Added pretty-print for all functions
mikelam-us-aixplain Sep 20, 2023
645e22f
Added functional test
mikelam-us-aixplain Sep 26, 2023
002f48d
Added test cleanup. Testing tests
mikelam-us-aixplain Sep 26, 2023
c7ba3cd
Adding debugging print statements
mikelam-us-aixplain Sep 26, 2023
c8003fd
Corrected some tests
mikelam-us-aixplain Sep 26, 2023
b8d1030
Corrected some tests
mikelam-us-aixplain Sep 26, 2023
feca2b8
Corrected json
mikelam-us-aixplain Sep 26, 2023
a5992f0
corrected module error
mikelam-us-aixplain Sep 26, 2023
19de919
delete has no response
mikelam-us-aixplain Sep 26, 2023
8ab3b27
Added delete_service_account
mikelam-us-aixplain Sep 26, 2023
798941c
Added e2e test
mikelam-us-aixplain Sep 26, 2023
4dcb2da
low-level client
mikelam-us-aixplain Sep 26, 2023
cd89990
low-level client
mikelam-us-aixplain Sep 26, 2023
2b97adf
low-level client
mikelam-us-aixplain Sep 26, 2023
ad7b005
Added assert statements
mikelam-us-aixplain Sep 26, 2023
f6f2bda
What if I don't add images?
mikelam-us-aixplain Sep 26, 2023
1847e98
delete corrected
mikelam-us-aixplain Sep 26, 2023
957f3b4
Added line for onboarding
mikelam-us-aixplain Sep 26, 2023
306c438
Removed list_image_tags because it won't be ready by this release
mikelam-us-aixplain Sep 27, 2023
2d93976
Added help for list_hosts
mikelam-us-aixplain Sep 27, 2023
78dde00
Added help messages to all the functions
mikelam-us-aixplain Sep 27, 2023
a5e106f
M 5079254326 container upload cli (#70)
mikelam-us-aixplain Oct 2, 2023
f191f62
Added yaml requirement
mikelam-us-aixplain Oct 4, 2023
77a3206
Added click requirement
mikelam-us-aixplain Oct 4, 2023
55e27e7
Moving those over to pyproject.toml
mikelam-us-aixplain Oct 4, 2023
815c762
Updating pyproject.toml to replace setup.py
mikelam-us-aixplain Oct 5, 2023
5d95cf7
Fully converted to pyproject.toml. Now testing
mikelam-us-aixplain Oct 5, 2023
2a68489
Removed extra license
mikelam-us-aixplain Oct 5, 2023
b0ff858
Merged namespace-change into this branch
mikelam-us-aixplain Oct 5, 2023
b37ed76
Working on extra dependency
MAlyafeai18 Oct 5, 2023
f5d8de1
Started image upload implementation
mikelam-us-aixplain Jul 27, 2023
e077df9
Adding create_asset
mikelam-us-aixplain Aug 9, 2023
8120271
Adding CLI
mikelam-us-aixplain Aug 14, 2023
134e9ee
Corrected entry point path
mikelam-us-aixplain Aug 14, 2023
6813288
Working on entry point path
mikelam-us-aixplain Aug 14, 2023
8e24629
create_asset_repo response
mikelam-us-aixplain Aug 21, 2023
4ebd34c
Refactored directories
mikelam-us-aixplain Sep 18, 2023
41a630b
Adding debug print statements to create_asset_repo
mikelam-us-aixplain Sep 18, 2023
55bb614
debugging weird function
mikelam-us-aixplain Sep 18, 2023
cad9b48
id -> code
mikelam-us-aixplain Sep 18, 2023
5528bef
Removed debugging statements
mikelam-us-aixplain Sep 18, 2023
6cb67c3
Corrected ID
mikelam-us-aixplain Sep 19, 2023
6316237
Adding pretty-print for list_functions
mikelam-us-aixplain Sep 20, 2023
ecf3da8
Added pretty-print for all functions
mikelam-us-aixplain Sep 20, 2023
4233548
Added functional test
mikelam-us-aixplain Sep 26, 2023
8b62ecf
Added test cleanup. Testing tests
mikelam-us-aixplain Sep 26, 2023
09d3490
Adding debugging print statements
mikelam-us-aixplain Sep 26, 2023
1b7dbc7
Corrected some tests
mikelam-us-aixplain Sep 26, 2023
521d38b
Corrected some tests
mikelam-us-aixplain Sep 26, 2023
249b87f
Corrected json
mikelam-us-aixplain Sep 26, 2023
bcfde7e
corrected module error
mikelam-us-aixplain Sep 26, 2023
fd7517b
delete has no response
mikelam-us-aixplain Sep 26, 2023
a686f29
Added delete_service_account
mikelam-us-aixplain Sep 26, 2023
93b4637
Added e2e test
mikelam-us-aixplain Sep 26, 2023
807fa9d
low-level client
mikelam-us-aixplain Sep 26, 2023
314dd01
low-level client
mikelam-us-aixplain Sep 26, 2023
19bb215
low-level client
mikelam-us-aixplain Sep 26, 2023
59c8b31
Added assert statements
mikelam-us-aixplain Sep 26, 2023
767dd52
What if I don't add images?
mikelam-us-aixplain Sep 26, 2023
9b1706b
delete corrected
mikelam-us-aixplain Sep 26, 2023
b39970e
Added help for list_hosts
mikelam-us-aixplain Sep 27, 2023
ee3f1e4
Moving those over to pyproject.toml
mikelam-us-aixplain Oct 4, 2023
63009e1
Updating pyproject.toml to replace setup.py
mikelam-us-aixplain Oct 5, 2023
1663dd7
Removed extra license
mikelam-us-aixplain Oct 5, 2023
fe118e9
Merged namespace-change into this branch
mikelam-us-aixplain Oct 5, 2023
20643e0
Working on extra dependency
MAlyafeai18 Oct 5, 2023
9e1d78c
Fixing merge conflicts
MAlyafeai18 Oct 5, 2023
08bd660
Updated dependencies
MAlyafeai18 Oct 8, 2023
30c7c4d
Fixed incorrect merge with main in model factory
mikelam-us-aixplain Oct 8, 2023
5f7dbfe
Added requests_mock
MAlyafeai18 Oct 9, 2023
fb6df03
Updated URLs
mikelam-us-aixplain Oct 9, 2023
6bebd2c
Passing all tests
mikelam-us-aixplain Oct 10, 2023
ba75465
Merge branch 'M-4891193010-container-upload' of https://github.com/ai…
mikelam-us-aixplain Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ aixplain is a software development kit (SDK) for the [aiXplain](https://aixplain
## Getting Started

### Installation
To install simply,
To install the base package, simply,
```bash
pip install aixplain
```

To install aiXplain with additional model building support:
```bash
pip install aixplain[model-builder]
```

### API Key Setup
Before you can use the aixplain SDK, you'll need to obtain an API key from our platform. For details refer this [Team API Key Guide](docs/user/api_setup.md).

Expand Down Expand Up @@ -63,4 +68,4 @@ Raise issues for support in this repository.
Pull requests are welcome!

## Note
The **aiXtend** python package was renamed to **aiXplain** from the release v0.1.1.
The **aiXtend** python package was renamed to **aiXplain** from the release v0.1.1.
21 changes: 0 additions & 21 deletions aixplain/__version__.py

This file was deleted.

58 changes: 58 additions & 0 deletions aixplain/cli_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
__author__ = "aiXplain"

"""
Copyright 2022 The aiXplain SDK authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: Michael Lam
Date: September 18th 2023
Description:
CLI Runner
"""
import click
from aixplain.factories.cli.model_factory_cli import list_host_machines, list_functions, create_asset_repo, asset_repo_login, onboard_model

@click.group('cli')
def cli():
pass

@click.group('list')
def list():
pass

@click.group('get')
def get():
pass

@click.group('create')
def create():
pass

@click.group('onboard')
def onboard():
pass

cli.add_command(list)
cli.add_command(get)
cli.add_command(create)
cli.add_command(onboard)

create.add_command(create_asset_repo)
list.add_command(list_host_machines)
list.add_command(list_functions)
get.add_command(asset_repo_login)
onboard.add_command(onboard_model)

def run_cli():
cli()
137 changes: 137 additions & 0 deletions aixplain/factories/cli/model_factory_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
__author__ = "aiXplain"

"""
Copyright 2022 The aiXplain SDK authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: Michael Lam
Date: September 18th 2023
Description:
Model Factory CLI
"""

from aixplain.factories.model_factory import ModelFactory
from typing import Dict, List, Optional, Text
import click
import yaml

@click.command("hosts")
@click.option("--api-key", default=None,
help="TEAM_API_KEY if not already set in environment")
def list_host_machines(api_key: Optional[Text] = None) -> None:
"""CLI wrapper function for the LIST_HOST_MACHINES function in
ModelFactory.

Args:
api_key (Text, optional): Team API key. Defaults to None.

Returns:
None
"""
ret_val = ModelFactory.list_host_machines(api_key)
ret_val_yaml = yaml.dump(ret_val)
click.echo(ret_val_yaml)

@click.command("functions")
@click.option("--verbose", default=False,
help="List all function details, False by default.")
@click.option("--api-key", default=None,
help="TEAM_API_KEY if not already set in environment.")
def list_functions(verbose: bool, api_key: Optional[Text] = None) -> None:
"""CLI wrapper function for the LIST_FUNCTIONS function in ModelFactory.

Args:
verbose (Boolean, optional): Set to True if a detailed response
is desired; is otherwise False by default.
api_key (Text, optional): Team API key. Defaults to None.
Returns:
None
"""
ret_val = ModelFactory.list_functions(verbose, api_key)
ret_val_yaml = yaml.dump(ret_val)
click.echo(ret_val_yaml)

@click.command("image-repo")
@click.option("--name", help="Model name.")
@click.option("--hosting-machine",
help="Hosting machine code obtained from LIST_HOSTS.")
@click.option("--version", help="Model version.")
@click.option("--description", help="Description of model.")
@click.option("--function", help="Function name obtained from LIST_FUNCTIONS.")
@click.option("--source-language", default="en",
help="Model source language in 2-character 639-1 code or 3-character 639-3 code.")
@click.option("--api-key", default=None,
help="TEAM_API_KEY if not already set in environment.")
def create_asset_repo(name: Text, hosting_machine: Text, version: Text,
description: Text, function: Text,
source_language: Text,
api_key: Optional[Text] = None) -> None:
"""CLI wrapper function for the CREATE_ASSET_REPO function in ModelFactory.

Args:
name (Text): Model name
hosting_machine (Text): Hosting machine ID obtained via list_host_machines
always_on (bool): Whether the model should always be on
version (Text): Model version
description (Text): Model description
function (Text): Model function name obtained via LIST_HOST_MACHINES
is_async (bool): Whether the model is asynchronous or not (False in first release)
source_language (Text): 2-character 639-1 code or 3-character 639-3 language code.
api_key (Text, optional): Team API key. Defaults to None.

Returns:
None
"""
ret_val = ModelFactory.create_asset_repo(name, hosting_machine, version,
description, function,
source_language, api_key)
ret_val_yaml = yaml.dump(ret_val)
click.echo(ret_val_yaml)

@click.command("image-repo-login")
@click.option("--api-key", default=None,
help="TEAM_API_KEY if not already set in environment.")
def asset_repo_login(api_key: Optional[Text] = None) -> None:
"""CLI wrapper function for the ASSET_REPO_LOGIN function in ModelFactory.

Args:
api_key (Text, optional): Team API key. Defaults to None.

Returns:
None
"""
ret_val = ModelFactory.asset_repo_login(api_key)
ret_val_yaml = yaml.dump(ret_val)
click.echo(ret_val_yaml)

@click.command("model")
@click.option("--model-id", help="Model ID from CREATE_IMAGE_REPO.")
@click.option("--image-tag", help="The tag of the image that you would like hosted.")
@click.option("--image-hash", help="The hash of the image you would like onboarded.")
@click.option("--api-key", default=None, help="TEAM_API_KEY if not already set in environment.")
def onboard_model(model_id: Text, image_tag: Text, image_hash: Text,
api_key: Optional[Text] = None) -> None:
"""CLI wrapper function for the ONBOARD_MODEL function in ModelFactory.

Args:
model_id (Text): Model ID obtained from CREATE_ASSET_REPO.
image_tag (Text): Image tag to be onboarded.
api_key (Text, optional): Team API key. Defaults to None.

Returns:
None
"""
ret_val = ModelFactory.onboard_model(model_id, image_tag, image_hash, api_key)
ret_val_yaml = yaml.dump(ret_val)
click.echo(ret_val_yaml)
Loading