Skip to content

Node.js (Typescript) Library client to help cheshire cat communication in your project

License

Notifications You must be signed in to change notification settings

matteocacciola/cheshirecat-typescript-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheshireCat Typescript Client


CheshireCat Typescript Client is a library to help the implementation of Cheshire Cat on a Javascript / Typescript (e.g. Node.js, React.js, Vue.js) Project

Installation

To install CheshireCat Typescript Client, run:

npm install cheshirecat-typescript-client

or, if you are using yarn:

yarn add cheshirecat-typescript-client

Usage

Initialization and usage:

import { CheshireCatClient, HttpClient, WSClient } from 'cheshirecat-typescript-client';

const cheshireCatClient = new CheshireCatClient(
    new WSClient('cheshire_cat_core', 1865, null),
    new HttpClient('cheshire_cat_core', 1865, null)
);

Send a message to the websocket:

import { Message } from 'cheshirecat-typescript-client';

const notificationClosure = (message: string) => {
 // handle websocket notification, like chat token stream
}

// result is the result of the message
const result = cheshireCatClient.message().sendWebsocketMessage(
    new Message("Hello world!", 'user', []),  // message body
    notificationClosure // websocket notification closure handle
);

Load data to the rabbit hole:

//file
const result = await cheshireCatClient.rabbitHole().postFile(file, null, null);

//url
const result = await cheshireCatClient.rabbitHole().postWeb(url, null,null);

Memory management utilities:

cheshireCatClient.memory().getMemoryCollections(); // get number of vectors in the working memory
cheshireCatClient.memory().getMemoryRecall("HELLO"); // recall memories by text

//delete memory points by metadata, like this example delete by source
cheshireCatClient.memory().deleteMemoryPointsByMetadata(Collection.Declarative, {"source": url});

About

Node.js (Typescript) Library client to help cheshire cat communication in your project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published