Via SDK
Interact with Nesa Chain via the official SDK
Nesa provides a developer-friendly SDK for executing inference requests in both browser and node environments.
Official SDK URL: https://www.npmjs.com/package/@nesaorg/ai-sdk
Overview
In this section, we cover high-level SDK usage information; on the other hand, a more detailed, code-level set of documentation can be found here.
1. AIClientRpc: Connect to Nesa Chain
Interactions with Nesa Chain take place via an AIClientRpc instance. To create one, pass your desired AIClientRpcConfiguration to your client's initialize method. You may find an example here.
2. AISession: Create a Session
Establishing a session allows you to place a one-time deposit, or lock, for your upcoming inference requests via an on-chain transaction. To create a session, pass your desired AIClientRpcSessionInitParams to your AIClientRpc instance's createSession method. You may find an example here.
modelName specifies the lowercased name of an available model.
lockAmount specifies the maximum amount of unes (0.000001 NES) to pay during the inference process. This amount is deducted immediately, with any unused portion refunded upon the session closing.
3. AIRequests: Inference Execution
This process takes place over a websocket connection for speedy, streaming interaction.
Construct and send an AIRequest in order to communicate with your session's designated model. Each model and/or task type may have a unique set of modelParams to be included with your request and necessary for proper execution. Inspect or use the getModelParameterDefaults function for insight regarding any required and optional parameters. You may find an example here.
Additional Resources
Getting Started: If you’re new to Nesa, check out the Getting Started guide.
Via Web: Utilize Nesa Chain AI Models using the Web. Learn more.
Via IBC: Connect with other blockchains using the Inter-Blockchain Communication protocol. Learn more.
We’re excited to have you explore Nesa via SDK. Enjoy a seamless and intuitive experience as you interact with the network!
Last updated

