Via SDK
Interact with Nesa Chain via the official SDK
Nesa provides a developer-friendly Node.js SDK for executing inference requests in both client and server environments.
Official SDK URL: https://github.com/nesaorg/nesa.js
Overview
In this section, we cover high-level SDK usage information; on the other hand, detailed documentation can be found in README.md
.
1. SDK Initialization
Interactions with a specific kernel are performed via a ChatClient
instance. To create an instance, pass your desired configuration parameters, such as modelName
, lockAmount
, and chainInfo
, to the constructor.
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 following the interaction.
2. Session Creation
Establishing a session confirms your unes lockup via a blockchain transaction. Complete this process with a call to the ChatClient
instance's requestSession
method.
3. Request & Response
This process takes place over a websocket connection for speedy, two-way interaction.
Begin your single- or multiple-message interaction with the configured kernel by using the ChatClient
instance's requestChat
method, passing it input via the messages
field.
Kernel Type | Input Data Format |
---|---|
|
|
|
|
|
|
Additional Resources
Getting Started: If you’re new to Nesa, check out the Getting Started guide.
Via Web: Utilize Nesa Chain AI Kernels using the Web. Learn more.
Via IBC: Connect with other blockchains using the Inter-Blockchain Communication protocol. Learn more.
Via Nesa CCI: Use the Nesa Command-Line Interface for advanced operations and automation. 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