npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sola-labs/ai-kit

v0.1.17

Published

The Tools and workflows that power Sola AI wrapped in an easy to integrate package!

Readme

Contributors Forks Stargazers Issues Unlicense License

About The Project

AI-Kit

Through the development of Sola AI, our flagship voice assistant on the Solana blockchain, we've pioneered a suite of custom implementations and tooling that intricately weave AI LLM's with the crypto and blockchain landscape. Recognizing the broader utility of these solutions, we are now sharing this library with fellow developers. Our aim is to fuel the Solana AI ecosystem, enabling you to seamlessly integrate the very tools that empower Sola AI within your own innovative projects. This library represents the heart and hard-won efficiencies derived from numerous iterations, ensuring both precision and performance.

Built With

Getting Started

AI-Kit is available as an NPM package that can be easily integrated into your TypeScript or JavaScript projects.

Prerequisites

AI-Kit is designed to work with Node.js projects. It has peer dependencies that you'll need to install.

  • Node.js (v16 or higher)
  • npm or yarn
  • An OpenAI API key (for some toolsets)

Installation

# Using npm
npm install @sola-labs/ai-kit

# Using yarn
yarn add @sola-labs/ai-kit

# Using pnpm
pnpm add @sola-labs/ai-kit

AI-Kit requires the following peer dependencies:

# Using npm
npm install ai@^4.0.0 @ai-sdk/openai@^1.0.0

# Using yarn
yarn add ai@^4.0.0 @ai-sdk/openai@^1.0.0

# Using pnpm
pnpm add ai@^4.0.0 @ai-sdk/openai@^1.0.0

Usage

Basic Usage

Below is a minimal example of how to use AI-Kit to create an AI agent:

import { SolaKit } from '@sola-labs/ai-kit';
import { OpenAILanguageModel } from '@ai-sdk/openai';

// Initialize the language model
const model = new OpenAILanguageModel({
  apiKey: process.env.OPENAI_API_KEY,
});

// Create a new SolaKit instance
const solaKit = new SolaKit({
  model,
  systemPrompt: 'You are a helpful assistant.',
  toolSetFactories: [], // Empty array for no toolsets initially
});

// Process a user query
async function processQuery(userInput: string) {
  const response = await solaKit.query({
    prompt: userInput,
  });

  console.log(response);
}

// Stream text responses (useful for UI applications)
async function streamResponse(userInput: string) {
  const stream = solaKit.streamText({
    prompt: userInput,
  });

  for await (const chunk of stream) {
    console.log(chunk); // Process each text chunk as it arrives
  }
}

Using Toolsets

AI-Kit comes with several pre-built toolsets that you can use. Here's how to use them:

import { SolaKit } from '@sola-labs/ai-kit';
import { OpenAILanguageModel } from '@ai-sdk/openai';
import { tokenToolSetFactory, nftToolSetFactory } from '@sola-labs/ai-kit/sola';

// Initialize the language model
const model = new OpenAILanguageModel({
  apiKey: process.env.OPENAI_API_KEY,
});

// Create a SolaKit instance with toolsets
const solaKit = new SolaKit({
  model,
  systemPrompt:
    'You are a helpful assistant with knowledge about Solana tokens and NFTs.',
  toolSetFactories: [tokenToolSetFactory, nftToolSetFactory],
});

// Process a query with specific toolsets
async function processTokenQuery(userInput: string) {
  const response = await solaKit.query({
    prompt: userInput,
    toolSets: ['token'], // Only use the token toolset for this query
    toolsContext: {
      authToken: 'your-auth-token', // Required by some tools
      walletPublicKey: 'your-wallet-public-key',
      apiClient: yourApiClientInstance, // Optional custom API client
    },
  });

  console.log(response);
}

Documentation

Available Toolsets

AI-Kit includes the following toolsets:

  1. Token Toolset (tokenToolSetFactory)

    • Features: Get token data, resolve token addresses, fetch top holders, get limit orders, etc.
    • Example: getTokenData tool returns detailed information about any token on Solana.
  2. NFT Toolset (nftToolSetFactory)

    • Features: Get NFT prices, find trending NFT collections
    • Example: getTrendingNFTs tool returns a list of currently popular NFT collections.
  3. Lulo Toolset (luloToolSetFactory)

    • Features: Get Lulo assets, deposit and withdraw from Lulo (a decentralized exchange on Solana)
    • Example: getLuloAssets tool returns user's assets and earnings on the Lulo platform.
  4. OnChain Toolset (onChainToolSetFactory)

    • Features: Resolve SNS names, swap tokens, transfer SOL and SPL tokens
    • Example: transferSolTx tool allows creating and signing SOL transfer transactions.
  5. AI Projects Toolset (aiProjectsToolSetFactory)

    • Features: Filter and find trending AI projects on Solana
    • Example: filterTrendingAiProjectsTool provides information about popular AI-related projects.

Creating Custom Toolsets

You can create your own toolsets that integrate with AI-Kit:

import {
  createToolSetFactory,
  createToolFactory,
} from '@sola-labs/ai-kit/tools';
import { z } from 'zod';

// Define a tool factory
const myCustomToolFactory = createToolFactory(
  {
    description: 'Description of what my custom tool does',
    parameters: z.object({
      param1: z.string().describe('Description of parameter 1'),
      param2: z.number().optional().describe('Optional numeric parameter'),
    }),
  },
  async (params, context) => {
    // Implement your tool logic here
    const result = await someAsyncOperation(params.param1, params.param2);

    return {
      success: true,
      data: result,
      error: undefined,
    };
  }
);

// Create a toolset factory that includes your tool
export const myCustomToolSetFactory = createToolSetFactory(
  {
    slug: 'custom',
    name: 'Custom Tools',
    description: 'A collection of custom tools for specific purposes.',
  },
  {
    myCustomTool: myCustomToolFactory,
  }
);

// Use your custom toolset in SolaKit
const solaKit = new SolaKit({
  model,
  systemPrompt: 'You are a helpful assistant.',
  toolSetFactories: [myCustomToolSetFactory],
});

Roadmap

  • [ ] Add more documentation and examples
  • [ ] Create plugin system for easy extension
  • [ ] Improve error handling and debugging
  • [ ] Add support for more language models
  • [ ] Build a comprehensive test suite
  • [ ] Create additional toolsets for DeFi applications

See the open issues for a list of proposed features and known issues.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

See the CONTRIBUTING.md file for more details on our development workflow.

Top contributors:

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contact

Sola AI - @SolaAI

Project Link: https://github.com/TheSolaAI/ai-kit

Acknowledgments