34 lines
829 B
JavaScript
34 lines
829 B
JavaScript
import ChatModel from "./python_bindings.js";
|
|
|
|
const chat = new ChatModel({ "model":"something" });
|
|
|
|
//await chat.setProperty( "model", "something");
|
|
await chat.setProperty( "tokenizer", 123 );
|
|
|
|
|
|
const modelResponse = await chat.getModelPath();
|
|
console.log(modelResponse); // { model: "something" }
|
|
|
|
const tokenizerResponse = await chat.getTokenizer();
|
|
console.log(tokenizerResponse); // { model: 123 }
|
|
|
|
let response = await chat.increment({ by: 5 });
|
|
console.log("Incremented counter:", response.counter);
|
|
|
|
response = await chat.increment({ by: 2 });
|
|
console.log("Incremented counter:", response.counter);
|
|
|
|
response = await chat.increment({ by: 2 });
|
|
console.log("Incremented counter:", response.counter);
|
|
|
|
chat.onMessage( function( data ) {
|
|
|
|
console.log( data );
|
|
|
|
} );
|
|
|
|
chat.testStream();
|
|
|
|
chat.end();
|
|
|