Unified prompt, evaluation, and production integration to any large model
Intelligent Node
IntelliNode is a javascript module that integrates cutting-edge AI into your project. With its intuitive functions, you can easily feed data to models like ChatGPT, LLaMA, WaveNet, and Stable diffusion and receive generated text, speech, or images. It also offers high-level functions such as semantic search, multi-model evaluation, and chatbot capabilities.
Access the module
One command and get access to latest models:
npm i intellinode
The Gen
function quickly generates tailored content in one line.
import:
const { Gen } = require('intellinode');
call:
// one line to generate html page code (openai gpt4 is default)
text = 'a registration page with flat modern theme.'
await Gen.save_html_page(text, folder, file_name, openaiKey);
// or generate blog post (using cohere)
const blogPost = await Gen.get_blog_post(prompt, apiKey, provider='cohere');
import:
const { Chatbot, ChatGPTInput } = require('intellinode');
call:
// set the system mode and the user message.
const input = new ChatGPTInput('You are a helpful assistant.');
input.addUserMessage('What is the distance between the Earth and the Moon?');
// get the responses from the chatbot
const chatbot = new Chatbot(OPENAI_API_KEY, 'openai');
const responses = await chatbot.chat(input);
The documentation on how to switch the chatbot between ChatGPT and LLama in this wiki page.
import:
const { SemanticSearch } = require('intellinode');
call:
const search = new SemanticSearch(apiKey);
// pivotItem is the item to search.
const results = await search.getTopMatches(pivotItem, searchArray, numberOfMatches);
const filteredArray = search.filterTopMatches(results, searchArray)
Generate improved prompts using LLMs:
const promptTemp = await Prompt.fromChatGPT("fantasy image with ninja jumping across buildings", openaiApiKey);
console.log(promptTemp.getInput());
import:
const { RemoteLanguageModel, LanguageModelInput } = require('intellinode');
call openai model:
const langModel = new RemoteLanguageModel('openai-key', 'openai');
model_name = 'text-davinci-003'
const results = await langModel.generateText(new LanguageModelInput({
prompt: 'Write a product description for smart plug that works with voice assistant.',
model: model_name,
temperature: 0.7
}));
console.log('Generated text:', results[0]);
change to call cohere models:
const langModel = new RemoteLanguageModel('cohere-key', 'cohere');
model_name = 'command-xlarge-20221108'
// ... same code
import:
const { RemoteImageModel, SupportedImageModels, ImageModelInput } = require('intellinode');
call DALL·E:
provider=SupportedImageModels.OPENAI;
const imgModel = new RemoteImageModel(apiKey, provider);
const images = await imgModel.generateImages(new ImageModelInput({
prompt: 'teddy writing a blog in times square',
numberOfImages: 1
}));
change to call Stable Diffusion:
provider=SupportedImageModels.STABILITY;
// ... same code
To access Openai services from your Azure account, you have to call the following function at the beginning of your application:
const { ProxyHelper } = require('intellinode');
ProxyHelper.getInstance().setAzureOpenai(resourceName);
To access Openai from a proxy for restricted regions:
ProxyHelper.getInstance().setOpenaiProxyValues(openaiProxyJson);
For more details and in-depth code, check the samples.
The code repository setup
Initiate the project:
cd IntelliNode
npm install
Create a .env file with the access keys:
OPENAI_API_KEY=<key_value>
COHERE_API_KEY=<key_value>
GOOGLE_API_KEY=<key_value>
STABILITY_API_KEY=<key_value>
HUGGING_API_KEY=<key_value>
run the remote language models test cases: node test/integration/RemoteLanguageModel.test.js
run the remote image models test cases: node test/integration/RemoteImageModel.test.js
run the remote speech models test cases: node test/integration/RemoteSpeechModel.test.js
run the embedding test cases: node test/integration/RemoteEmbedModel.test.js
run the chatBot test cases: node test/integration/Chatbot.test.js
📕 Documentation
Pillars
The module foundation:
Roadmap
Call for contributors: registration form .
Author: intelligentnode
Source Code: https://github.com/intelligentnode/IntelliNode
License: Apache-2.0 license