
Intelligent Java(Intellijava)は、Javaを使用した最新の言語モデルやディープラーニングフレームワークと統合するための究極のツールです。ライブラリは、ChatGptやDall・Eなどのモデルに入力を送信し、生成されたテキスト、音声、または画像を受信するための直感的な機能を提供します。わずか数行のコードを使用すると、最先端のAIモデルの力に簡単にアクセスしてプロジェクトを強化できます。
サポートされているモデル:
RemoteLanguageModel 、画像生成のためのRemoteImageModel 、テキストからスピーチモデルへのRemoteSpeechModel 、およびChatGPTのChatbotを呼び出してください。 Maven Central Repositoryにリリースされたパッケージ:
メイベン:
< dependency >
< groupId >io.github.barqawiz</ groupId >
< artifactId >intellijava.core</ artifactId >
< version >0.8.2</ version >
</ dependency >Gradle:
implementation 'io.github.barqawiz:intellijava.core:0.8.2'
Gradle(Kotlin):
implementation("io.github.barqawiz:intellijava.core:0.8.2")
jarダウンロード:intellijava.jar。
言語モデルコード(2ステップ):
// 1- initiate the remote language model
String apiKey = "<add-openai-api-key>" ;
RemoteLanguageModel langModel = new RemoteLanguageModel ( apiKey , "openai" );
// 2- call generateText with any command !
LanguageModelInput langInput = new LanguageModelInput . Builder ( "Summarize the plot of the 'Inception' movie in two sentences" )
. setModel ( "text-davinci-003" ). setTemperature ( 0.7f ). setMaxTokens ( 50 ). build ();
String resValue = langModel . generateText ( langInput );出力: Inception follows Dom Cobb, a professional thief, who is offered a chance at redemption in exchange for planting an idea in a target's mind. He must navigate a dangerous landscape of dream-sharing technology and battle his inner demons in order to complete the mission and find his way back to reality.
画像生成コード(2ステップ):
// 1- initiate the remote image model
RemoteImageModel imageModel = new RemoteImageModel ( apiKey , "openai" );
// 2- call generateImages with any command !
ImageModelInput imageInput = new ImageModelInput . Builder ( "teddy writing a blog in times square" )
. setNumberOfImages ( 2 ). setImageSize ( "1024x1024" ). build ();
List < String > images = imageModel . generateImages ( imageInput );出力: 
テキストから音声コード(2ステップ):
// 1- initiate the remote speech model
RemoteSpeechModel model = new RemoteSpeechModel ( apiKey , SpeechModels . google );
// 2- call generateEnglishText with any text
Text2SpeechInput input = new Text2SpeechInput . Builder ( "Hi, I am Intelligent Java." ). build ();
byte [] decodedAudio = model . generateEnglishText ( input );出力:
// save temporary audio file for testing
AudioHelper . saveTempAudio ( decodedAudio );ChatGptコード:
// 1- initiate the chat model.
Chatbot bot = new Chatbot ( apiKey , SupportedChatModels . openai );
// 2- prepare the chat history by calling addMessage.
String mode = "You are a helpful astronomy assistant." ;
ChatModelInput input = new ChatGPTInput . Builder ( mode )
. addUserMessage ( "what is the space between moon and earth" ). build ();
// 3- call chat!
List < String > resValues = bot . chat ( input );出力: The average distance between the Moon and the Earth is about 238,855 miles (384,400 kilometers).
完全な例と準備ができた統合については、sample_codeを試してください。
唯一の依存関係はGSONです。 Intellijava jarを使用するときに手動で追加する必要があります。ただし、Mavenを介してこのレポをインポートすると、依存関係が処理されます。
JARのダウンロード:GSONダウンロードレポ
貢献者を呼びます:
Apacheライセンス
著作権2023 github.com/barqawiz/intellijava
Apacheライセンス、バージョン2.0(「ライセンス」)に基づいてライセンスされています。ライセンスに準拠している場合を除き、このファイルを使用することはできません。ライセンスのコピーを取得できます
http://www.apache.org/licenses/LICENSE-2.0
適用法で要求されていないか、書面で合意されていない限り、ライセンスに基づいて配布されたソフトウェアは、明示または黙示のいずれかの保証または条件なしに、「現状のまま」に基づいて配布されます。ライセンスに基づく権限と制限を管理する特定の言語のライセンスを参照してください。