เครื่องมือบรรทัดคำสั่งสำหรับเรียกใช้คำสั่ง GPT เครื่องมือนี้รองรับปลั๊กอินการจับคู่พรอมต์การป้องกันและแชท GPT
ใช้เครื่องมือนี้เพื่อ
คุณจะต้องสร้างคีย์ OpenAI API หากคุณมีบัญชีคุณสามารถสร้างคีย์ได้ที่นี่
https://platform.openai.com/account/api-keys
อย่าแชร์คีย์ API ของคุณกับผู้อื่นหรือเปิดเผยในเบราว์เซอร์หรือรหัสฝั่งไคลเอ็นต์อื่น ๆ คุณจะต้องเสียค่าใช้จ่ายใด ๆ หากมีคนใช้คีย์ของคุณ อย่าตรวจสอบคีย์ของคุณลงในที่เก็บสาธารณะใด ๆ
สร้างไฟล์ที่มีคีย์ API ของคุณ (ไฟล์ด้านล่างไม่จริง) ในตัวอย่างของเรา เราตั้งชื่อไฟล์ API_KEY และเพิ่มคีย์
sk-gKtTxOumv4orO6cfWlh0ZK
ตรวจสอบให้แน่ใจว่าคุณติดตั้งลูกดอก ทำตามคำแนะนำในลิงค์ด้านล่าง
https://dart.dev/get-dart
หลังจากการติดตั้งคุณสามารถติดตั้งโปรแกรม GPT ด้วยคำสั่งต่อไปนี้
Dart Pub Global Activate GPT
ต่อไปนี้เป็นกรณีการใช้งานที่รองรับ
เรียกใช้คำสั่ง Project
air genp
ก่อนอื่นคุณจะต้องเลือกต้นแบบ
? Project Archetype ›
❯ Prompt
Chain
Batch
Image
ChatGPT Plugin
ป้อน ProjectName และ Projectversion
✔ Project Archetype · Prompt
✔ Project Name: · myproject
✔ Project Version: · 1.0
ขึ้นอยู่กับโครงการคุณอาจต้องป้อนคีย์ API ของคุณ คุณสามารถข้ามใช้ไฟล์คีย์ที่มีอยู่หรือสร้างไฟล์คีย์ใหม่
? Import Key ›
❯ Skip
Use Existing OpenAI API Key File
Create New OpenAI API Key File
ตัวเลือกต่อไปนี้ช่วยให้เราสามารถป้อนคีย์ API ได้โดยตรง มันจะบันทึกคีย์ลงในไฟล์ หากคุณมีปัญหาในการคัดลอกและวางคีย์เพียงป้อนอักขระสองสามตัวแล้วแก้ไขไฟล์หลังจากนั้น
✔ Import Key · Create New OpenAI API Key File
? API Key: › sk-gKtTxOumv4orO6cfWlh0ZK
โครงการปลั๊กอิน Chatgpt ช่วยให้คุณสามารถสร้างต้นแบบอย่างรวดเร็วของปลั๊กอิน Chatgpt โดยเฉพาะจะช่วยให้คุณเยาะเย้ยการตอบสนองต่อ CHATGPT โครงการนี้ใช้โครงการ QuickStart ที่: https://github.com/openai/plugins-quickstart
ไฟล์โครงการของคุณจะมีลักษณะ
---
projectName : plugin-quickstart
projectVersion : ' 1.0 '
projectType : plugin
defaultConfig :
properties :
port : 5003
nameForHuman : TODO Plugin (no auth)
nameForModel : todo
descriptionForHuman : Plugin for managing a TODO list, you can add, remove and view your TODOs.
mockedRequests :
- path : " /todos/global "
method : get
mockedResponse : todos-global.json
- path : " /todos/user "
method : get
mockedResponse : todos-global.json
pluginServers :
- serverId : todo-mike
flavor : mike
# mocked requests
mockedRequests :
- path : " /todos/mike "
method : get
mockedResponse : todos.json # returns the content of this file
# Adds a different user for testing
- serverId : todo-kaleb
flavor : kaleb
mockedRequests :
- path : " /todos/kaleb "
method : get
mockedResponse : todos.json
properties :
showHttpHeaders : true # Show http headers in logsการกำหนดค่าใด ๆ ในโหนด DefaultConfig จะถูกนำไปใช้กับปลั๊กอินแต่ละตัวเว้นแต่ปลั๊กอินนั้นจะแทนที่คุณสมบัติโดยเฉพาะ
ตัวอย่างการตอบสนองที่ล้อเลียน ( todos.json ) ได้รับด้านล่าง สิ่งนี้จะถูกส่งกลับไปยัง /todos /mike
{
"todos" : [
" Clean out a septic tank " ,
" Repair a broken sewer pipe " ,
" Collect roadkill for disposal " ,
" Assist in bee hive relocation " ,
" Service a grease trap at a restaurant "
]
}ในการเริ่มต้นอินสแตนซ์ล้อเลียนของเซิร์ฟเวอร์ปลั๊กอิน
air plugin
หรือเพื่อเริ่มเซิร์ฟเวอร์เฉพาะเพิ่มตัวเลือก ServerID
air plugin --serverId todo-mike
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับการสร้างและการใช้ chatgpt-plugin
หากคุณเลือกที่จะสร้างโครงการรูปภาพคุณจะถูกขอคำอธิบาย ไม่ต้องกังวลคุณสามารถเปลี่ยนได้ในภายหลังหลังจากสร้างโครงการ
? Image Description: › A goldfish with big eyes
ไฟล์โครงการของคุณจะมีลักษณะ
projectName : image-2
projectVersion : 2.0
apiKeyFile : api_key
blocks :
- blockId : image-block-1
pluginName : ImageGptPlugin
executions :
# First Image
- id : img-1
sizes :
- 256
- 256
- 1024
prompt : image.prompt
properties :
imageDescription : A goldfish with big eyesคุณจะแจ้งให้ไฟล์
Generate a picture of a ${imageDescription}
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับรูปภาพ

ต่อไปนี้ถามว่ามีกี่ครั้งในการเรียกใช้ข้อมูลแบทช์ หากคุณเลือก 5 ครั้งมันจะเรียกใช้ข้อมูลแบทช์ทั้งหมดเรียก 5 ครั้ง
? Number of Times to Run The Block: › 5
คุณจะเห็นไฟล์โครงการดังต่อไปนี้
---
projectName : mybatch
projectVersion : 1.0
apiKeyFile : api_key
blocks :
- blockId : batch-1
pluginName : BatchGptPlugin
blockRuns : 5
configuration :
requestParams :
model : gpt-3.5-turbo
temperature : 0.7
top_p : 1
max_tokens : 500
executions :
- id : batch-1
dataFile : batch-data.json
prompt : batch.promptพรอมต์เป็นพรอมต์ Hello World ที่เรียบง่าย
Write me a paragraph about the world I live in
World: ```${my_world}```
ไฟล์ batch-data.json มีข้อมูลแบทช์
{
"my_world" : [
" Hello World, I live in a magical place with magical creatures " ,
" Hello World, I live in a futuristic Utopia " ,
" Hello World, I live in a futuristic Dystopia "
]
}แก้ไขไฟล์สองไฟล์นี้ด้วยข้อมูลของคุณเอง สำหรับข้อมูลเพิ่มเติมเกี่ยวกับแบทช์
ต่อไปนี้ถามว่ามีกี่ครั้งที่จะเรียกใช้คำขอพรอมต์ หากคุณเลือก 5 ครั้งมันจะเรียกใช้คำขอแจ้งเตือนทั้งหมด 5 ครั้ง
? Number of Times to Run The Block: › 5
ถัดไปเลือกรูปแบบผลลัพธ์ คุณต้องการตอบกลับข้อความตรงหรือคุณต้องการในรูปแบบ JSON
? Response Format ›
JSON
❯ TEXT
หากคุณเลือก JSON คุณจะถูกถามว่าคุณต้องการเปิดใช้งานการตอบกลับ JSON หรือไม่ สิ่งนี้จะพยายามแยกวิเคราะห์ข้อความภายนอกที่ผู้ช่วย AI อาจเพิ่ม
? Attempt to FIX JSON Responses? (y/n) › no
ไฟล์โครงการจะมีลักษณะ
---
projectName : prompt-1
projectVersion : 1.0
apiKeyFile : api_key
blocks :
- blockId : single-1
pluginName : ExperimentGptPlugin
blockRuns : 5
configuration :
requestParams :
model : gpt-3.5-turbo
temperature : 1.2
top_p : 1
max_tokens : 500
executions :
- id : exp-1
responseFormat : json
fixJson : false
promptChain :
- prompt-json.prompt
properties :
character : Commander in Starfleet
mainCharacterName : ' '
- blockId : report-1
pluginName : ReportingGptPlugin
executions :
- id : report-1
blockIds :
- single-1ไฟล์มีค่าเริ่มต้นบางอย่างสำหรับคำขอ OpenAI เปลี่ยนให้เหมาะกับความต้องการของคุณ โดยค่าเริ่มต้นจะเพิ่มปลั๊กอินการรายงานซึ่งสร้างเอาต์พุต HTML ของการตอบกลับผู้ใช้/ผู้ช่วย
prompt-json.prompt ดูเหมือนต่อไปนี้ หมายเหตุว่าเอาต์พุตระบุวิธีการใช้ JSON ได้อย่างไร ปรับเปลี่ยนพรอมต์และคุณสมบัติตามความต้องการของคุณ
Write me a story about ${character}. The main character is ${mainCharacterName}.
If no main character is given, choose one. Write one sentence only.
The response should be in JSON using the following structure:
Only use these fields. {"mainCharacterName": "", "story": ""}
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับพรอมต์
เลือกต้นแบบโครงการ โซ่ จากนั้นผ่านตัวเลือก
? Number of Times to Run The Block: › 1
? Attempt to FIX JSON Responses? (y/n) › yes
? Number of Times to Run The Prompt Chain: › 2
ไฟล์ project.yaml ที่สร้างขึ้น
---
projectName : " chain-project "
projectVersion : " 1.0 "
apiKeyFile : " api_key "
blocks :
# Block demonstrates the use of importing properties
- blockId : chain-1
pluginName : ExperimentGptPlugin
blockRuns : 1 # Number of Stories
configuration :
requestParams :
model : gpt-3.5-turbo
temperature : 1.2
top_p : 1
max_tokens : 500
executions :
- id : exp-1-import
chainRuns : 2 # Number of times to run the promptChain
promptChain :
- story.prompt
- user-action.prompt # Simulates user input
excludesMessageHistory :
- user-action.prompt
fixJson : true
responseFormat : json
# Import properties from a properties file
import :
propertiesFile : properties.json # predefined values
properties :
planet : 1 # Earth
action : 3 # Lands on the planet
- blockId : report-1
pluginName : ReportingGptPlugin
executions :
- id : report-1
blockIds :
- chain-1ฟิลด์คุณสมบัติในไฟล์ Project.yaml ด้านบนชี้ไปที่ดัชนีภายในไฟล์ Properties.json อยู่ด้านล่าง ไฟล์นี้ช่วยให้คุณสามารถเปลี่ยนอินพุตทดสอบได้อย่างง่ายดาย
{
"planet" : [
" Earth " ,
" Venus " ,
" Jupiter "
],
"action" : [
" Blows up the planet " ,
" Observes the planet From Orbit " ,
" Lands on the planet " ,
" Zips around the planet and hopes no one notices "
]
}เครื่องมือจะแทนที่โลก "โลก" และการกระทำ "ลงจอดบนโลก" ลงในเรื่องราวที่พร้อมท์ด้านล่าง ขอให้สังเกตว่า AI จะสร้างชื่อของตัวละครและย่อหน้าแรกของเรื่อง
The response will be in JSON Format.
Captain ${captainsName} is near ${planet}. .
The last part of the story is: ${story}
Then the captain ${action}
Tell me a story about what happens next.
Be very descriptive. Write two sentences only.
Give me the captains name, if I haven't given it.
RESPONSE
The response must only be in JSON using the following structure.
Only use these fields. {"captainsName": "${captainsName}", "story": ""}
เครื่องมือจะผ่านชื่อกัปตันที่ส่งคืนและเรื่องราวจากพรอมต์แรกไปยัง ผู้ใช้แอ็คชั่น . prompt เราจะได้รับการกระทำที่ตัวละครกลับมา
Give me an action for ${captainsName} for the following story:
${story}
The response must be in JSON using the following structure.
Only use these fields. {"action": ""}
ตอนนี้เราจะเรียกใช้ เรื่องราว อีกครั้ง แต่คราวนี้เราจะมีทั้งชื่อกัปตันและการกระทำครั้งต่อไปที่เขาทำ
การติดตามคือเอาต์พุตตัวอย่างจากการรันจริง
As Captain John lands on the planet, he feels the trembling beneath his feet and sees the vibrant green flora around him.
He plants the Earth's flag to claim its new discovery and soon finds a thriving alien civilization welcoming him with open arms.
[user action "plants the flag to claim the new discovery"]
As Captain John plants the Earth's flag on the newfound planet, he is approached by the leaders of the alien civilization
who speak his language and reveal that they have known about Earth for centuries. They invite him to partake in a feast in
his honor, where he learns about their advanced technology and way of life.
ขอให้สังเกตว่าการรันโซ่นั้นเหมือนกับจำนวนย่อหน้าที่เรามีในเอาต์พุต หากเราต้องการย่อหน้าอื่นเราจะตั้ง chainruns เป็น 3 ถ้าเราตั้ง blockruns เป็น 5 เราจะสร้างเรื่องราวที่แตกต่างกัน 5 เรื่อง
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับโซ่
ในการสร้างรายงาน HTML ให้เพิ่ม ReportingGptPlugin เป็นบล็อกสุดท้าย ภายใต้ blockids เพิ่มรหัสบล็อกก่อนหน้านี้ที่คุณต้องการเพิ่มลงในรายงานที่สร้างขึ้น
---
projectName : experiment-reporting
projectVersion : ' 1.7 '
apiKeyFile : " ../../api_key "
blocks :
- blockId : chain-1
pluginName : ExperimentGptPlugin
blockRuns : 1
...
# Generate HTML Report
- blockId : report-1
pluginName : ReportingGptPlugin
executions :
- id : report-execution
blockIds :
- chain-1 รายงานจะแสดงการแชททั้งหมดสำหรับการดำเนินการบล็อกที่กำหนดค่า

สำหรับข้อมูลเพิ่มเติมเกี่ยวกับการรายงาน
อากาศ -ช่วยเหลือ
A command line tool for running GPT commands
Usage: air <command> [arguments]
Global options:
-h, --help Print this usage information.
Available commands:
clean Cleans project's output directory
count Returns the number of OpenApiCalls that would be made
genp Generates a new project
plugin Runs local version of ChatGPT Plugin
run Runs a project's blocks
Run "air help <command>" for more information about a command.
ในการทำความสะอาดโครงการเรียกใช้สิ่งต่อไปนี้
อากาศสะอาด
สิ่งนี้จะลบไดเรกทอรี ผลลัพธ์ สำหรับโครงการ
การเรียกใช้การโทร OpenAI ด้วยเครื่องมืออาจมีค่าใช้จ่ายสูงหากคุณกำหนดค่าผิดพลาด หากต้องการกำหนดจำนวน OpenAI ที่เรียกว่าโครงการจะเรียกใช้คำสั่งต่อไปนี้
จำนวนอากาศ
หรือสำหรับการนับบล็อกเฉพาะ
จำนวนอากาศ -b myblockid
มันจะส่งออก
Project: product-summary-2.8
Total OpenAPI Calls would be 12
หากคุณต้องการทราบว่าโครงการของคุณกำลังทำอยู่ก่อนที่จะมีค่าใช้จ่ายในการเปิดให้ใช้ OpenAI ให้ใช้ธง Dryrun
Air Run -Dryrun
Executing Block
Running Project: image-generation-2.3
BlockId: image-1, PluginName: ImageGptPlugin
----------
Starting Block Run: 1
Starting execution: 1 - Requires 1 calls to OpenAI
POST to https://api.openai.com/v1/images/generations
{"prompt":"Generate a picture of a Unicorn with a gold horn and wings","n":1,"size":"256x256","response_format":"url"}
Finished execution: 1
Starting execution: 2 - Requires 2 calls to OpenAI
POST to https://api.openai.com/v1/images/generations
{"prompt":"Generate a picture of a fish with giant eyes","n":1,"size":"256x256","response_format":"b64_json"}
POST to https://api.openai.com/v1/images/generations
{"prompt":"Generate a picture of a fish with giant eyes","n":1,"size":"512x512","response_format":"b64_json"}
Finished execution: 2
--------
Finished running project: 0 seconds