Skip to content

Commit

Permalink
Merge pull request #55 from intelligentnode/52-add-chat-context-function
Browse files Browse the repository at this point in the history
Upgrade npm release
  • Loading branch information
intelligentnode authored Sep 10, 2023
2 parents 4512f96 + 9efc859 commit 38dd90c
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 10 deletions.
7 changes: 3 additions & 4 deletions IntelliNode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
IntelliNode is the ultimate tool to integrate with the latest language models and deep learning frameworks using **javascript**. The library provides intuitive functions for sending input to models like ChatGPT, WaveNet and Stable diffusion, and receiving generated text, speech, or images. With just a few lines of code, you can easily access the power of cutting-edge AI models to enhance your projects.

# Latest Updates
- Add a chat context function to manage the relevant messages for chatbots.
- Update the chatbot to support Llama v2 chat and code. 🦙
- Add Gen function, the fastest way to generate text, speech, web pages or images. :bullettrain_side:
- Update stable diffusion to use XL model engine.
- Add Gen function, the fastest way to generate text, speech, code, or images. :bullettrain_side:
- Update stable diffusion to use the XL model engine.
- Add support for hugging face inference.
- Generate prompt using LLM.
- Add support for huge data memory semantic search using `SemanticSearchPaging`.
- Update the chatbot with `stream` function.
- Update the module to support next integration.

Join the [discord server](https://discord.gg/VYgCh2p3Ww) for the latest updates and community support.

Expand Down
2 changes: 1 addition & 1 deletion IntelliNode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intellinode",
"version": "1.4.0",
"version": "1.4.1",
"description": "Access various AI models, such as ChatGPT, Llama, Diffusion, Cohere, Hugging face, and others",
"main": "index.js",
"keywords": [
Expand Down
8 changes: 4 additions & 4 deletions samples/command_sample/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/command_sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
"dotenv": "^16.0.3",
"intellinode": "^1.4.0"
"intellinode": "^1.4.1"
}
}
49 changes: 49 additions & 0 deletions samples/command_sample/test_chat_context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const { ChatContext } = require('intellinode');
require("dotenv").config();
const assert = require('assert');

const apiKey = process.env.OPENAI_API_KEY;

async function testGetSimpleContext() {

const context = new ChatContext(apiKey);
const userMessage = "Hello";
const historyMessages = ["Good morning", "Dinner time", "How can I help you?", "Hello"];
const n = 3;

const resultContext = await context.getStringContext(userMessage, historyMessages, n);

console.log('result: ', resultContext)

assert.strictEqual(resultContext.length, n);
}

// Test for getRoleContext
async function testGetRoleContext() {

const context = new ChatContext(apiKey);
const userMessage = "Hello";
const historyMessages = [
{ role: 'user', content: 'Dinner time' },
{ role: 'user', content: 'Good Morning' },
{ role: 'assistant', content: 'How can I help you?' },
{ role: 'user', content: 'Hello' }
];
const n = 3;

const resultContext = await context.getRoleContext(userMessage, historyMessages, n);

console.log('resultContext: ', resultContext)

assert.strictEqual(resultContext.length, n);

}


(async () => {
console.log('### execute the string context history ###')
await testGetSimpleContext();

console.log('### execute the role dictionary context history ###')
await testGetRoleContext();
})();

0 comments on commit 38dd90c

Please sign in to comment.