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 🙏

© 2024 – Pkg Stats / Ryan Hefner

velosify-ai

v1.0.0

Published

An npm library for integrating ChatGPT and other AI services.

Downloads

62

Readme

Velosify AI

velosify-ai is a Node.js library designed to seamlessly integrate AI services like OpenAI’s ChatGPT into your Node.js projects. This library enables developers to easily interact with AI APIs and get powerful results with minimal setup.

Author

Repository

Table of Contents

  1. Installation
  2. Usage
  1. API Methods
  2. Future Implementations
  3. Running Tests
  4. Contributing
  5. License
  6. Contact

Installation

To install the velosify-ai library, use the following command:

npm install velosify-ai

Make sure you have Node.js and npm installed before proceeding.

Usage

Once installed, you can use velosify-ai to interact with various AI services. The first version of this library supports OpenAI’s ChatGPT, and more AI platforms will be integrated in future updates.

Example with ChatGPT (OpenAI)

  1. Install dependencies (if not already installed):
npm install velosify-ai axios dotenv
  1. Create a .env file in your project root:
OPENAI_API_KEY=your_openai_api_key_here
  1. Create a simple JavaScript file (e.g., index.js) to use the library:
const AIClient = require('velosify-ai');

// Initialize the AIClient with your OpenAI API key
const client = new AIClient(process.env.OPENAI_API_KEY);

async function getChatGPTResponse() {
  try {
    const response = await client.sendMessage('What is the capital of France?');
    console.log('ChatGPT says:', response);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

getChatGPTResponse();

Detailed Explanation

  • AIClient Constructor:

    • Takes your API key (from OpenAI) as the first parameter.
    • The second parameter is optional and specifies the AI service provider (defaults to 'openai').
  • sendMessage method:

    • Sends a message to the specified AI model (defaults to 'gpt-3.5-turbo').
    • Returns the AI’s response.

API Methods

new AIClient(apiKey, provider = 'openai')

  • Description: Initializes the AIClient with the provided API key and the AI provider (currently only supports 'openai').
  • Parameters:
    • apiKey (string): Your API key for the AI service (required).
    • provider (string, optional): The AI provider to use. Defaults to 'openai'.

sendMessage(message, model = 'gpt-3.5-turbo')

  • Description: Sends a message to the specified AI model and returns the response.
  • Parameters:
    • message (string): The text message to send to the AI model.
    • model (string, optional): The AI model to use (e.g., 'gpt-3.5-turbo'). Defaults to 'gpt-3.5-turbo'.
  • Returns: The AI’s response as a string.

Future Implementations

In upcoming versions, support for additional AI platforms will be added. Future AI integrations include:

  • Google Cloud AI (Vertex AI)
  • Microsoft Azure Cognitive Services
  • Hugging Face API
  • Cohere
  • Anthropic’s Claude
  • Stability AI
  • IBM Watson
  • AssemblyAI
  • DeepL

Running Tests

The library includes tests that ensure everything works as expected. To run the tests, follow these steps:

  1. Install dependencies:
npm install
  1. Run the tests using Jest:
npm test

This will execute the test suite located in the test/ directory, ensuring the library’s functionality is intact.

Contributing

We welcome contributions to the velosify-ai library! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make your changes.
  4. Run the tests to ensure everything works.
  5. Submit a pull request with a description of your changes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For questions, feature requests, or other inquiries, feel free to contact me: