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

llm-konnect

v0.0.9

Published

LLM-Konnect NPM package for React/Next JS web applications. Allowing users to integrated services of LLM into their web applications.

Downloads

51

Readme

Project Title: LLM-Konnect

LLM-Konnect is a TypeScript-based project that provides a set of APIs for managing chatbots. It includes multiple functionalities that can be accessed using the provided APIs.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Node.js and npm installed on your machine.
  • A basic understanding of TypeScript and JavaScript.

Getting the SDK key

To use the LLM-Konnect SDK, you need to get the SDK key from the LLM platform. The SDK key is used to authenticate your requests to the LLM platform. Visit website LLM-KONNECT to get the SDK key.

Installing the SDK

To install the SDK, run the following command:

npm install llm-konnect

Setting up the SDK Configuration

Set the SDK in your project. Here's how you can set the SDK key:

import { SDKConfig } from 'llm-konnect';
SDKConfig.setSDKKey('your_sdk_key');

Importing the Functions

Once you have installed the package and set the initial SDK configuration, you can import the functions into your file. Here's how you can do it:

import {
    addUser,
    initializeChatbot,
    getUserChatbots,
    addUIConfig,
    getUIConfig,
    updateData,
    getData,
    removeData,
    getChatbot,
    removeChatbot
} from 'llm-konnect';

Functionalities

The main functionalities provided by this project are:

  • Initialize Chatbot: This function initializes a chatbot with the given input parameters.
  • Chat with Chatbot: This function sends a message to a specific chatbot that has been initialized.
  • Update Data: This function updates the data of a specific chatbot.
  • Add Tool: This function adds a tool to a specific chatbot.
  • Get User Chatbots: This function retrieves all chatbots associated with a specific user.
  • Add UI Config: This function adds a UI configuration for a chatbot.
  • Get UI Config: This function retrieves the UI configuration for a specific chatbot.
  • Get Chatbot: This function retrieves the details of a specific chatbot.
  • Remove Chatbot: This function removes a specific chatbot.
  • Remove Tool: This function removes a tool from a specific chatbot.
  • Remove UI Config: This function removes the UI configuration for a specific chatbot.

Using the Functions

Initialize Chatbot

The initializeChatbot function is used to initialize a new chatbot. Here's how you can use it:

const chatbotInput = {
    userId: 1,
    chatbot_name: 'testbot',
    purpose: 'testing',
    type: 'faq',
};

initializeChatbot(chatbotInput)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Chat with Chatbot

To chat with a chatbot, you need to create an object with the required parameters and pass it to the chat function. Here's an example:

import { chat } from 'llm-konnect';

const chatInput = {
    chatbot_id: 1,
    session_id: 'session1',
    question: 'Hello?',
};

chat(chatInput)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Get User Chatbots

The getUserChatbots function is used to get all chatbots associated with a specific user. Here's how you can use it:

const userId = 1;

getUserChatbots(userId)
    .then(chatbots => console.log(chatbots))
    .catch(error => console.error(error));

Add UI Config

The addUIConfig function is used to add a UI configuration for a chatbot. Here's how you can use it:

const uiConfig = {
    chatbot_id: 1,
    font_color: '#000000',
    font_size: '16px',
    user_message_color: '#0000FF',
    system_message_color: '#FF0000',
    chatbot_icon: 'https://example.com/icon.png',
    header_color: '#00FF00',
    header_font_color: '#FFFFFF',
    bot_name: 'Test Bot',
    welcome_message: 'Welcome to the test bot!',
    user_font_color: '#000000',
    system_font_color: '#000000',
    sample_question1: 'What is your name?',
    sample_question2: 'What is your age?',
    sample_question3: 'What is your favorite color?',
};

addUIConfig(uiConfig)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Get UI Config

The getUIConfig function is used to get the UI configuration for a specific chatbot. Here's how you can use it:

const chatbotId = 1;

getUIConfig(chatbotId)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Update Data

The updateData function is used to update the data of a specific chatbot. Here's how you can use it:

const updateDataRequest = {
    chatbot_id: 4,
    text: "Some new information to add",
    document_name: "New Document",
    website_urls: ["https://nu.edu.pk/"],
    depth: 2,
};

updateData(updateDataRequest)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Get Data

The getData function is used to get the data of a specific chatbot. Here's how you can use it:

const chatbotId = 4;

getData(chatbotId)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Remove Data

The removeData function is used to remove the data of a specific chatbot. Here's how you can use it:

const chatbotId = 4;
const documentName = 'New Document';

removeData(chatbotId, documentName)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Get Chatbot

The getChatbot function is used to get the details of a specific chatbot. Here's how you can use it:

const chatbotId = 1;

getChatbot(chatbotId)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Remove Chatbot

The removeChatbot function is used to remove a specific chatbot. Here's how you can use it:

const chatbotId = 4;

removeChatbot(chatbotId)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Add Tool

The addTool function is used to add a tool to a specific chatbot. Here's how you can use it:

import { addTool } from 'llm-konnect';

const toolInput = {
    chatbot_id: 1,
    tool_name: 'Tool Name',
    tool_description: 'Tool Description',
};

addTool(toolInput)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Remove Tool

The removeTool function is used to remove a tool from a specific chatbot. Here's how you can use it:

import { removeTool } from 'llm-konnect';

const toolInput = {
    chatbot_id: 1,
    tool_name: 'Tool Name',
};

removeTool(toolInput)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Get All Tools

The getAllTools function is used to get all tools associated with a specific chatbot. Here's how you can use it:

import { getAllTools } from 'llm-konnect';
getAllTools()
   .then(response => console.log(response))
   .catch(error => console.error(error));

Please replace the placeholders with the actual details of your project.