
Intelligent Java (Intellijava) เป็นเครื่องมือที่ดีที่สุดในการรวมเข้ากับรูปแบบภาษาล่าสุดและกรอบการเรียนรู้ลึกโดยใช้ Java ห้องสมุดมีฟังก์ชั่นที่ใช้งานง่ายสำหรับการส่งอินพุตไปยังรุ่นเช่น ChatGPT และ Dall · E และรับข้อความคำพูดหรือรูปภาพที่สร้างขึ้น ด้วยรหัสเพียงไม่กี่บรรทัดคุณสามารถเข้าถึงพลังของโมเดล AI ที่ทันสมัยเพื่อปรับปรุงโครงการของคุณ
รุ่นที่รองรับ:
RemoteLanguageModel สำหรับโมเดลภาษา RemoteImageModel สำหรับการสร้างภาพ RemoteSpeechModel สำหรับข้อความถึงข้อความพูดและ Chatbot สำหรับ ChatGPT แพ็คเกจที่เผยแพร่ไปยังที่เก็บ Maven Central:
Maven:
< 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 อย่างไรก็ตามหากคุณนำเข้า repo นี้ผ่าน Maven มันจะจัดการกับการพึ่งพา
สำหรับการดาวน์โหลด jar: gson ดาวน์โหลด repo
โทรหาผู้มีส่วนร่วม:
ใบอนุญาต Apache
ลิขสิทธิ์ 2023 github.com/barqawiz/intellijava
ได้รับใบอนุญาตภายใต้ใบอนุญาต Apache เวอร์ชัน 2.0 ("ใบอนุญาต"); คุณไม่สามารถใช้ไฟล์นี้ยกเว้นตามใบอนุญาต คุณอาจได้รับสำเนาใบอนุญาตที่
http://www.apache.org/licenses/LICENSE-2.0
เว้นแต่ว่ากฎหมายที่บังคับใช้หรือตกลงเป็นลายลักษณ์อักษรซอฟต์แวร์ที่แจกจ่ายภายใต้ใบอนุญาตจะถูกแจกจ่ายตาม "ตามพื้นฐาน" โดยไม่มีการรับประกันหรือเงื่อนไขใด ๆ ไม่ว่าจะโดยชัดแจ้งหรือโดยนัย ดูใบอนุญาตสำหรับภาษาเฉพาะที่ควบคุมการอนุญาตและข้อ จำกัด ภายใต้ใบอนุญาต