
Intellinode是一个JavaScript模块,将尖端AI集成到您的项目中。 With its intuitive functions, you can easily feed data to models like ChatGPT , LLaMA , WaveNet , Gemini and Stable diffusion and receive generated text, speech, or images.它还提供了高级功能,例如语义搜索,多模型评估和聊天机器人功能。
一个命令并访问最新型号:
npm i intellinode
有关详细的用法说明,请参阅文档。
Gen函数很快在一行中生成量身定制的内容。
进口:
const { Gen } = require ( 'intellinode' ) ;称呼:
// 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' ) ;进口:
const { Chatbot , ChatGPTInput } = require ( 'intellinode' ) ;称呼:
// set chatGPT 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 chatGPT responses.
const chatbot = new Chatbot ( OPENAI_API_KEY , 'openai' ) ;
const responses = await chatbot . chat ( input ) ;Intellinode可以轻松地交换AI模型。
const { Chatbot , GeminiInput , SupportedChatModels } = require ( 'intellinode' ) ; const input = new GeminiInput ( ) ;
input . addUserMessage ( 'Who painted the Mona Lisa?' ) ;
const geminiBot = new Chatbot ( apiKey , SupportedChatModels . GEMINI ) ;
const responses = await geminiBot . chat ( input ) ;可以在Intellinode Wiki中找到Chatgpt,Llama,Cohere,Mistral等之间切换聊天机器人提供商的文档。
进口:
const { SemanticSearch } = require ( 'intellinode' ) ;称呼:
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 )使用LLMS生成改进的提示:
const promptTemp = await Prompt . fromChatGPT ( "fantasy image with ninja jumping across buildings" , openaiApiKey ) ;
console . log ( promptTemp . getInput ( ) ) ;进口:
const { RemoteLanguageModel , LanguageModelInput } = require ( 'intellinode' ) ;致电OpenAI型号:
const langModel = new RemoteLanguageModel ( 'openai-key' , 'openai' ) ;
model_name = 'gpt-3.5-turbo-instruct'
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 ] ) ;更改以调用Cohere模型:
const langModel = new RemoteLanguageModel ( 'cohere-key' , 'cohere' ) ;
model_name = 'command-xlarge-20221108'
// ... same code进口:
const { RemoteImageModel , SupportedImageModels , ImageModelInput } = require ( 'intellinode' ) ;致电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
} ) ) ;更改以调用稳定扩散:
provider = SupportedImageModels . STABILITY ;
// ... same code要从您的Azure帐户访问OpenAI Services,您必须在应用程序开始时调用以下功能:
const { ProxyHelper } = require ( 'intellinode' ) ;
ProxyHelper . getInstance ( ) . setAzureOpenai ( resourceName ) ;从限制区域的代理中访问OpenAI:
ProxyHelper . getInstance ( ) . setOpenaiProxyValues ( openaiProxyJson ) ;有关更多详细信息和深入代码,请检查样本。
cd IntelliNode
npm install
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>
运行远程语言模型测试用例: 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
The module foundation:
Call for contributors: registration form .
Apache许可证
版权2023 github.com/barqawiz/intellinode
根据Apache许可证(版本2.0(“许可”)获得许可;除了符合许可外,您不得使用此文件。您可以在
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或以书面形式同意,否则根据许可证分配的软件是按照“原样”分发的,没有任何明示或暗示的任何形式的保证或条件。请参阅许可证,以获取执行许可条款和限制的特定语言。