แพ็คเกจนี้ทำให้การโต้ตอบของคุณกับโมเดล GPT ต่างๆ ง่ายขึ้น โดยไม่จำเป็นต้องใช้โทเค็นหรือวิธีอื่นในการเข้าถึง GPT มันยังให้คุณใช้ปัญญาประดิษฐ์สามอย่างเพื่อสร้างรูปภาพได้: DALL·E, Prodia และอื่น ๆ อีกมากมาย ซึ่งบางอันเป็นแบบพรีเมียมในขณะที่บางอันนั้นฟรี ทั้งหมดนี้ไม่มีข้อจำกัดหรือข้อจำกัด
คุณสามารถติดตั้งแพ็คเกจผ่าน NPM
npm i gpti
ซื้อโค้ด API ของฉันผ่าน Patreon และใช้งานได้โดยไม่มีข้อจำกัดกับรุ่นใดๆ โดยไม่ยุ่งยากและไม่มีข้อจำกัด
GPTI ให้การเข้าถึงโมเดลปัญญาประดิษฐ์ที่หลากหลายเพื่อตอบสนองความต้องการที่หลากหลาย ปัจจุบันรุ่นที่มีจำหน่ายได้แก่:
หากคุณต้องการเข้าถึงรุ่นพรีเมียม ให้ป้อนข้อมูลประจำตัวของคุณ คุณสามารถรับได้โดยคลิกที่นี่
// import { nexra } from "gpti";
// const { nexra } = require("gpti");
const { nexra } = require ( "gpti" ) ;
nexra ( "user-xxxxxxxx" , "nx-xxxxxxx-xxxxx-xxxxx" ) ;
// import { gpt } from "gpti";
const { gpt } = require ( "gpti" ) ;
let data = await gpt . v1 ( {
messages : [
{
role : "assistant" ,
content : "Hello! How are you today?"
} ,
{
role : "user" ,
content : "Hello, my name is Yandri."
} ,
{
role : "assistant" ,
content : "Hello, Yandri! How are you today?"
}
] ,
prompt : "Can you repeat my name?" ,
model : "GPT-4" ,
markdown : false
} ) ;
console . log ( data ) ;
เลือกหนึ่งในโมเดลที่มีอยู่เหล่านี้ใน API เพื่อปรับปรุงประสบการณ์ของคุณ
มันค่อนข้างคล้ายกัน โดยมีความแตกต่างตรงที่มีความสามารถในการสร้างการตอบสนองแบบเรียลไทม์ผ่านการสตรีมโดยใช้ gpt-3.5-turbo
// import { gpt } from "gpti";
const { gpt } = require ( "gpti" ) ;
let messages = [
{
"role" : "assistant" ,
"content" : "Hello! How are you today?"
} ,
{
"role" : "user" ,
"content" : "Hello, my name is Yandri."
} ,
{
"role" : "assistant" ,
"content" : "Hello, Yandri! How are you today?"
} ,
{
"role" : "user" ,
"content" : "Can you repeat my name?"
}
] ;
let data = await gpt . v2 ( {
messages : messages ,
markdown : false ,
stream : false
} ) ;
console . log ( data ) ;
/*
// Streaming
gpt.v2({
messages: messages,
stream: true,
markdown: false,
results: (err, data) => {
console.log(err, data);
}
});
*/
ฉันได้ปรับปรุง GPT-4 แล้ว แต่ข้อผิดพลาดอาจเกิดขึ้นเนื่องจากความซับซ้อนทางเทคโนโลยี ขอแนะนำให้ใช้ความระมัดระวังเมื่อต้องอาศัยความถูกต้องแม่นยำในการสืบค้นข้อมูลออนไลน์
// import { gpt } from "gpti";
const { gpt } = require ( "gpti" ) ;
let data = await gpt . web ( {
prompt : "Are you familiar with the movie Wonka released in 2023?" ,
markdown : false
} ) ;
console . log ( data ) ;
// import { gpt } from "gpti";
const { gpt } = require ( "gpti" ) ;
let history = [
{
"role" : "user" ,
"content" : "Hello! How are you? Could you tell me your name?"
}
] ;
let data = await gpt . v3 ( {
messages : history ,
markdown : false ,
stream : false
} ) ;
console . log ( data ) ;
/*
// Streaming
gpt.v3({
messages: history,
stream: true,
markdown: false,
results: (err, data) => {
console.log(err, data);
}
});
*/
// import { bing } from "gpti";
const { bing } = require ( "gpti" ) ;
let history = [
{
role : "assistant" ,
content : "Hello! How can I help you today? ?"
} ,
{
role : "user" ,
content : "Hi, tell me the names of the movies released in 2023."
} ,
{
role : "assistant" ,
content : "Certainly! Here are some movies that were released in 2023:nn1. **About My Father** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n2. **The Little Mermaid** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n3. **Fast X** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n4. **Spider-Man: Across the Spider-Verse** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n5. **The Machine** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n6. **Book Club: The Next Chapter** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n7. **Guardians of the Galaxy Vol. 3** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n8. **John Wick: Chapter 4** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n9. **Are You There God? It's Me, Margaret** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n10. **Evil Dead Rise** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n11. **The Super Mario Bros. Movie** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n12. **Love Again** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n13. **Kandahar** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n14. **Dungeons & Dragons: Honor Among Thieves** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n15. **Shin Kamen Rider** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n16. **Knights of the Zodiac** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n17. **The Pope's Exorcist** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n18. **Shazam! Fury of the Gods** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n19. **All That Breathes** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n20. **Sailor Moon Cosmos** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n21. **Hypnotic** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n22. **Sound of Freedom** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n23. **The Boogeyman** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n24. **Chicken Run: Dawn of the Nugget** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n25. **A Lot of Nothing** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n26. **Followers** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n27. **Big George Foreman** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n28. **Asterix & Obelix: The Middle Kingdom** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n29. **Ant-Man and the Wasp: Quantumania** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n30. **Transformers: Rise of the Beasts** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n31. **Follow Her** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n32. **Prom Pact** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n33. **God Is a Bullet** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n34. **Still: A Michael J. Fox Movie** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n35. **Nefarious** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n36. **Nanny Dearest** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n37. **Monica** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n38. **Wild Life** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n39. **Palm Trees and Power Lines** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n40. **What's Love Got to Do with It?** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n41. **Creed III** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n42. **One True Loves** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n43. **BlackBerry** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n44. **Suzume** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n45. **Rock Dog 3: Battle the Beat** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n46. **Gridman Universe** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n47. **Digimon Adventure 02: The Beginning** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n48. **Woman of the Photographs** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n49. **El Tonto** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)n50. **Seriously Red** [^1^](https://editorial.rottentomatoes.com/guide/best-movies-of-2023/)nnI hope this helps! Let me know if you have any other questions."
} ,
{
role : "user" ,
content : "Can you tell me how many movies you've told me about?"
}
] ;
let data = await bing ( {
messages : history ,
conversation_style : "Balanced" ,
markdown : false ,
stream : false
} ) ;
console . log ( data ) ;
/*
// Streaming
bing({
messages: history,
conversation_style: "Balanced",
stream: true,
markdown: false,
results: (err, data) => {
console.log(err, data);
}
});
*/
พารามิเตอร์ | ค่าเริ่มต้น | คำอธิบาย |
---|---|---|
การสนทนา_สไตล์ | สมดุล | คุณสามารถใช้ระหว่าง: "สมดุล", "สร้างสรรค์" และ "แม่นยำ" |
มาร์กดาวน์ | เท็จ | คุณสามารถแปลงบทสนทนาเป็นสตรีมต่อเนื่องหรือไม่แปลงเป็น Markdown ได้ |
ลำธาร | เท็จ | คุณจะได้รับตัวเลือกในการเลือกว่าคุณต้องการให้การตอบกลับแบบเรียลไทม์หรือไม่ |
// import { llama } from "gpti";
const { llama } = require ( "gpti" ) ;
let history = [
{
"role" : "user" ,
"content" : "Hello! How are you? Could you tell me your name?"
}
] ;
let data = await llama ( {
messages : history ,
markdown : false ,
stream : false
} ) ;
console . log ( data ) ;
/*
// Streaming
llama({
messages: history,
stream: true,
markdown: false,
results: (err, data) => {
console.log(err, data);
}
});
*/
// import { blackbox } from "gpti";
const { blackbox } = require ( "gpti" ) ;
let history = [
{
"role" : "user" ,
"content" : "Hello! How are you? Could you tell me your name?"
}
] ;
let data = await blackbox ( {
messages : history ,
markdown : false ,
stream : false
} ) ;
console . log ( data ) ;
/*
// Streaming
blackbox({
messages: history,
stream: true,
markdown: false,
results: (err, data) => {
console.log(err, data);
}
});
*/
ตรวจสอบเอกสารประกอบที่นี่เพื่อเรียนรู้วิธีใช้โมเดลการสร้างรูปภาพต่างๆ
// import { imageai } from "gpti";
const { imageai } = require ( "gpti" ) ;
let data = await imageai ( {
prompt : "cat color red" ,
model : "dalle" ,
response : "url" | "base64" ,
data : { }
} ) ;
console . log ( data ) ;
ในปัจจุบัน บางรุ่นต้องใช้ข้อมูลประจำตัวของคุณจึงจะเข้าถึงได้ ในขณะที่บางรุ่นก็ใช้งานได้ฟรี สำหรับรายละเอียดและตัวอย่างเพิ่มเติม โปรดดูเอกสารประกอบฉบับสมบูรณ์
นี่คือรหัสข้อผิดพลาดที่จะแสดงในกรณีที่ API ล้มเหลว
รหัส | ข้อผิดพลาด | คำอธิบาย |
---|---|---|
400 | BAD_REQUEST | ป้อนพารามิเตอร์ทั้งหมดไม่ถูกต้อง |
500 | ภายใน_SERVER_ERROR | เซิร์ฟเวอร์ประสบปัญหาความล้มเหลว |
200 | API ทำงานได้โดยไม่มีปัญหา | |
403 | ต้องห้าม | ข้อมูลรับรอง API ไม่ถูกต้อง |
401 | ไม่ได้รับอนุญาต | ต้องมีข้อมูลรับรอง API |