From 5562e4373b1817200cd7b7a22bbbf4f744924d68 Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Mon, 25 Sep 2023 10:41:41 +0900 Subject: [PATCH] docs: fix readme --- README.md | 55 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 88e726e..78ed6ef 100644 --- a/README.md +++ b/README.md @@ -16,42 +16,51 @@ yarn install @ainize-team/ainize-sdk ### Import ```typescript import Ainize from '@ainize-team/ainize-sdk' -const ainize = new Ainize(, ); +const ainize = new Ainize(); ``` CHAIN_ID - 0: AI Network test net - 1: AI Network main net -### App -You can manage the AI Network app required for operating AI Services. +### Login +You should login to ainize with AI Network account before deploy the container. ```typescript -ainize.app.create(, ); -ainize.app.setTriggerFunction(, ); -ainize.app.setBillingConfig(, ); -ainize.app.setRules(, ); -ainize.app.addAdmin(,
); -ainize.app.deleteAdmin(,
); +ainize.login(); ``` -- APP_NAME: The app name to be registered on AI Network. -- SERVICE_URL: The URL for sending API requests to your AI Service. +### Deploy +You can deploy your AI model to ainize. +```typescript +const model = await ainize.deploy(); +``` +CONFIGURATION +- modelName: The name you want to deploying model. +- billingConfig: Billing configuration required for model usage. + - depositAddress: The address for receiving AIN deposits. + - costPerToken: Cost per token for model usage. + - minCost: Minimum cost. + - maxCost: Maximum cost. (optional) -### Service -You can use AI Service. +You can stop or run your model container. Model deployer only can use this. ```typescript -ainize.service.deposit(, ); -ainize.service.writeRequest(, , ); +model.stop(); +model.run(); ``` -### Admin -You can get user requests. +### Using Model +You can use a model using `ainize.model()`. ```typescript -ainize.admin.deposit(); -ainize.admin.writeResponse(, , , ); +const model = await ainize.model(); ``` -## Test -```bash -yarn test -``` \ No newline at end of file +You should deposit AIN to credit before using model. +```typescript +await model.deposit(); +const balance = await model.getCreditBalance(); +``` + +If you have enough credit, you can use the model. +```typescript +const result = await model.use(); +```