
Intellinodeは、最先端のAIをプロジェクトに統合するJavaScriptモジュールです。直感的な機能により、 ChatGpt 、 Llama 、 Wavenet 、 Gemini 、 Stable Diffusionなどのモデルにデータを簡単に送信でき、生成されたテキスト、音声、または画像を受信できます。また、セマンティック検索、マルチモデル評価、チャットボット機能などの高レベル機能も提供しています。
1つのコマンドと最新のモデルへのアクセスを取得します。
npm i intellinode
詳細な使用手順については、ドキュメントを参照してください。
Gen関数は、1行でテーラードコンテンツを迅速に生成します。
輸入:
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 ) ;ChatGpt、Llama、Cohere、Mistralなどの間にチャットボットプロバイダーを切り替えるためのドキュメントは、Intellinode Wikiで見つけることができます。
輸入:
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 ] ) ;Calle Modelsを呼び出すに変更します:
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 codeAzureアカウントからOpenAIサービスにアクセスするには、アプリケーションの先頭に次の関数を呼び出す必要があります。
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
リモート画像モデルのテストケースを実行します: node test/integration/RemoteImageModel.test.js
リモート音声モデルの実行テストケース: node test/integration/RemoteSpeechModel.test.js
埋め込みテストケースを実行します: node test/integration/RemoteEmbedModel.test.js
チャットボットテストケースを実行します: node test/integration/Chatbot.test.js
モジュールファンデーション:
貢献者の呼び出し:登録フォーム。
Apacheライセンス
著作権2023 github.com/barqawiz/intellinode
Apacheライセンス、バージョン2.0(「ライセンス」)に基づいてライセンスされています。ライセンスに準拠している場合を除き、このファイルを使用することはできません。ライセンスのコピーを取得できます
http://www.apache.org/licenses/LICENSE-2.0
適用法で要求されていないか、書面で合意されていない限り、ライセンスに基づいて配布されたソフトウェアは、明示または黙示のいずれかの保証または条件なしに、「現状のまま」に基づいて配布されます。ライセンスに基づく権限と制限を管理する特定の言語のライセンスを参照してください。