From 26a08fd1d7f27a3a5774cc32e4fd87601a747891 Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Wed, 18 Dec 2024 09:32:02 +0900 Subject: [PATCH] fix: examples --- examples/charge.ts | 6 +++--- examples/deploy.ts | 8 ++++---- examples/request.ts | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/charge.ts b/examples/charge.ts index 7bff876..df95e89 100644 --- a/examples/charge.ts +++ b/examples/charge.ts @@ -1,17 +1,17 @@ -import { Ainize } from '@ainize-team/ainize-js'; +import Ainize from '@ainize-team/ainize-js'; const ainPrivateKey = ''; // Insert your private key here const main = async () => { try { const ainize = new Ainize(1); // 0 for testnet, 1 for mainnet. You can earn testnet AIN at https://faucet.ainetwork.ai/. await ainize.login(ainPrivateKey); console.log('balance: ',await ainize.getAinBalance()); - const model = await ainize.getModel('ainize_free_inference'); + const model = await ainize.getModel('meta-llama/Llama-3.1-8B-instruct'); console.log(model.modelName); console.log("before charge: ",await model.getCreditBalance()); await model.chargeCredit(10); console.log("after charge: ",await model.getCreditBalance()); ainize.logout(); - }catch(e) { + } catch(e) { console.log(e); } } diff --git a/examples/deploy.ts b/examples/deploy.ts index 7e97092..be57a6d 100644 --- a/examples/deploy.ts +++ b/examples/deploy.ts @@ -1,19 +1,19 @@ -import { Ainize } from '@ainize-team/ainize-js'; +import Ainize from '@ainize-team/ainize-js'; const ainPrivateKey = ''; // Insert your private key here const main = async () => { try { const ainize = new Ainize(1); // 0 for testnet, 1 for mainnet. You can earn testnet AIN at https://faucet.ainetwork.ai/. await ainize.login(ainPrivateKey); - console.log('balance: ',await ainize.getAinBalance()); + console.log('balance: ', await ainize.getAinBalance()); const deployConfig = { modelName: 'YOUR_MODEL_NAME', - modelUrl: 'YOUR_MODEL_INFERENCE_URL' // e.g. https://ainize-free-inference.ainetwork.xyz + modelUrl: 'YOUR_MODEL_INFERENCE_URL' } const model = await ainize.deploy(deployConfig); console.log(model.modelName); ainize.logout(); - }catch(e) { + } catch(e) { console.log(e); } } diff --git a/examples/request.ts b/examples/request.ts index f5cc401..b29cc68 100644 --- a/examples/request.ts +++ b/examples/request.ts @@ -1,4 +1,4 @@ -import { Ainize } from '@ainize-team/ainize-js'; +import Ainize from '@ainize-team/ainize-js'; const ainPrivateKey = ''; // Insert your private key here const main = async () => { @@ -6,7 +6,7 @@ const main = async () => { const ainize = new Ainize(1); // 0 for testnet, 1 for mainnet. You can earn testnet AIN at https://faucet.ainetwork.ai/. await ainize.login(ainPrivateKey); console.log('balance: ',await ainize.getAinBalance()); - const inferenceModel = await ainize.getModel('ainize_free_inference'); + const inferenceModel = await ainize.getModel('meta-llama/Llama-3.1-8B-instruct'); console.log(inferenceModel.modelName); console.log(await inferenceModel.getCreditBalance()); const request = { @@ -17,7 +17,7 @@ const main = async () => { const response = await inferenceModel.request(request); console.log(response); ainize.logout(); - }catch(e) { + } catch(e) { console.log(e); } }