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.


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 herearrow-up-right.


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 herearrow-up-right.


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 herearrow-up-right.

circle-info

modelName specifies the lowercased name of an available model.

circle-info

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 herearrow-up-right.


Additional Resources


We’re excited to have you explore Nesa via SDK. Enjoy a seamless and intuitive experience as you interact with the network!

Last updated