LogoLogo
  • Nesa Docs
    • Introduction to Nesa
    • Overview of the Nesa System
      • AI Models: Repository, Standardization, Uniformity
      • Users: Why Do We Need Private Inference?
      • Node Runners: Doing Inference and Earning $NES
    • Organization of the Documentation
  • Technical Designs
    • Decentralized Inference
      • Overview
      • Model Partitioning and Deep Network Sharding
      • Dynamic Sharding of Arbitrary Neural Networks
      • Cache Optimization to Enhance Efficiency
      • BSNS with Parameter-efficient Fine-tuning via Adapters
      • Enhanced MTPP Slicing of Topological Order
      • Swarm Topology
      • Additional: Free-Riding Prevention
    • Security and Privacy
      • Overview
      • Hardware Side: Trusted Execution Environments (TEEs)
      • Software/algorithm Side: Model Verification
        • Zero-knowledge Machine Learning (ZKML)
        • Consensus-based Distribution Verification (CDV)
      • Software/algorithm Side: Data Encryption
        • Visioning: Homomorphic Encryption
        • Implementation: Split Learning (HE)
      • Additional Info
        • Additional Info: Trusted Execution Environments (TEEs)
        • Additional Info: Software-based Approaches
    • Overview of $NES
      • $NES Utility
    • The First Application on Nesa: DNA X
    • Definitions
    • Additional Information
      • Dynamic Model Versioning and Fork Management
      • Nesa's Utility Suite
      • The AI Kernel Market
      • Privacy Technology
        • Trusted Execution Environment (TEE)
        • Secure Multi-Party Computation (MPC)
        • Verifiable Random Function (VRF)
        • Zero-Knowledge Proof (ZKP)
      • The Integration of Evolutionary AI to Evolve the Nesa Ecosystem
      • Interoperability and Nesa Future Plans
  • Using Nesa
    • Getting Started
      • Wallet Setup
      • Testnet Nesa Faucet
    • Via Web
      • Your Nesa Account
      • Selecting an AI Kernel
      • Submitting a Query
    • Via SDK
    • Via IBC
    • Via NESBridge
      • On Sei
  • Run a Nesa Node
    • Prerequisites
    • Installation
    • Troubleshooting
    • FAQ
  • Links
    • nesa.ai
    • Nesa Discord
    • Nesa Twitter
    • Nesa dApp: dnax.ai
    • Nesa dApp: DNA X Docs
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • Overview
  • 1. SDK Initialization
  • 2. Session Creation
  • 3. Request & Response
  • Additional Resources
  1. Using Nesa

Via SDK

Interact with Nesa Chain via the official SDK

PreviousSubmitting a QueryNextVia IBC

Last updated 5 months ago

Nesa provides a developer-friendly Node.js SDK for executing inference requests in both client and server environments.

Official SDK URL:


Overview

In this section, we cover high-level SDK usage information; on the other hand, detailed documentation can be found in .


1. SDK Initialization

Interactions with a specific kernel are performed via a 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

text-generation

text-classification

token-classification

translation

summarization

sentiment-analysis

[

{

"content": "<query>",

"role": "user"

}

]

question-answering

[

{

"input": "<query>",

"context": "<context>",

"role": "user"

}

]

object-detection

image-segmentation

depth-estimation

image-classification

feature-extractor

[

{

"input": "<image_ipfs_cid>",

"role": "user"

}

]


Additional Resources


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

Getting Started: If you’re new to Nesa, check out the guide.

Via Web: Utilize Nesa Chain AI Kernels using the Web. .

Via IBC: Connect with other blockchains using the Inter-Blockchain Communication protocol. .

Via Nesa CCI: Use the Nesa Command-Line Interface for advanced operations and automation. .

https://github.com/nesaorg/nesa-sdk
README.md
ChatClient
Getting Started
Learn more
Learn more
Learn more