Alat baris perintah untuk menjalankan perintah GPT. Alat ini mendukung plugin pemasangan prompt, prompt-rantai, dan chatgpt.
Gunakan alat ini untuk
Anda perlu membuat kunci API OpenAI. Jika Anda memiliki akun, Anda dapat membuat kunci di sini
https://platform.openai.com/account/api-keys
Jangan membagikan kunci API Anda dengan orang lain, atau mengeksposnya di browser atau kode sisi klien lainnya. Anda akan dikenakan biaya jika seseorang menggunakan kunci Anda. Jangan periksa kunci Anda ke repositori publik.
Buat file yang berisi kunci API Anda (yang di bawah ini tidak nyata). Dalam contoh kami. Kami memberi nama file API_Key dan menambahkan kunci.
sk-gKtTxOumv4orO6cfWlh0ZK
Pastikan anak panah Anda telah diinstal. Ikuti instruksi, di tautan di bawah ini.
https://dart.dev/get-dart
Setelah instalasi, Anda dapat menginstal program GPT dengan perintah berikut
Dart pub global mengaktifkan GPT
Berikut ini adalah kasus penggunaan yang didukung
Jalankan perintah Proyek Generate
air genp
Pertama -tama Anda harus memilih pola dasar
? Project Archetype ›
❯ Prompt
Chain
Batch
Image
ChatGPT Plugin
Masukkan Nama Proyek dan ProjectVersion
✔ Project Archetype · Prompt
✔ Project Name: · myproject
✔ Project Version: · 1.0
Bergantung pada proyek, Anda mungkin perlu memasukkan kunci API Anda. Anda dapat melewatkan, menggunakan file kunci yang ada atau membuat file kunci baru
? Import Key ›
❯ Skip
Use Existing OpenAI API Key File
Create New OpenAI API Key File
Opsi berikut memungkinkan kami untuk memasukkan kunci API secara langsung. Ini akan menyimpan kunci ke file. Jika Anda mengalami kesulitan menyalin dan menempelkan kunci, cukup masukkan beberapa karakter dan kemudian edit file sesudahnya.
✔ Import Key · Create New OpenAI API Key File
? API Key: › sk-gKtTxOumv4orO6cfWlh0ZK
Proyek plugin chatgpt memungkinkan Anda melakukan prototipe cepat plugin chatgpt. Secara khusus memungkinkan Anda untuk mengejek tanggapan terhadap chatgpt. Proyek ini didasarkan pada proyek QuickStart di: https://github.com/openai/plugins-quickstart
File proyek Anda akan terlihat seperti
---
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 logsKonfigurasi apa pun di node DefaultConfig akan diterapkan ke setiap pluginserver kecuali plugin itu secara khusus menimpa properti.
Contoh respons yang diejek ( Todos.json ) diberikan di bawah ini. Ini akan dikembalikan pada panggilan ke /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 "
]
}Untuk memulai instance yang diejek dari server plugin
air plugin
atau untuk memulai server tertentu, tambahkan opsi serverid
air plugin --serverId todo-mike
Untuk informasi lebih lanjut tentang membuat dan menggunakan chatgpt-plugin
Jika Anda memilih untuk membuat proyek gambar, Anda akan diminta deskripsi. Jangan khawatir Anda dapat mengubahnya nanti setelah menghasilkan proyek.
? Image Description: › A goldfish with big eyes
File proyek Anda akan terlihat seperti
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 eyesFile Anda akan
Generate a picture of a ${imageDescription}
Untuk informasi lebih lanjut tentang gambar

Berikut ini bertanya berapa kali untuk menjalankan data batch. Jika Anda memilih 5 kali, itu akan menjalankan semua panggilan data batch masing -masing 5 kali.
? Number of Times to Run The Block: › 5
Anda akan melihat file proyek seperti berikut
---
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.promptPrompt adalah hello world prompt sederhana
Write me a paragraph about the world I live in
World: ```${my_world}```
File Batch-Data.json berisi data batch.
{
"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 "
]
}Ubah dua file ini dengan data Anda sendiri. Untuk informasi lebih lanjut tentang batch
Berikut ini bertanya berapa kali menjalankan permintaan prompt. Jika Anda memilih 5 kali, itu akan menjalankan semua permintaan prompt 5 kali.
? Number of Times to Run The Block: › 5
Selanjutnya pilih format output. Apakah Anda hanya menginginkan respons teks lurus, atau Anda menginginkannya dalam format JSON.
? Response Format ›
JSON
❯ TEXT
Jika Anda memilih JSON, Anda akan ditanya apakah Anda ingin mengaktifkan respons JSON. Ini akan berusaha mengurai teks asing yang dapat ditambahkan oleh asisten AI.
? Attempt to FIX JSON Responses? (y/n) › no
File proyek akan terlihat seperti
---
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-1File tersebut mencakup beberapa nilai default untuk permintaan OpenAI. Ubah mereka agar sesuai dengan kebutuhan Anda. Secara default, ini juga menambahkan plugin pelaporan yang menghasilkan output HTML dari respons pengguna/asisten.
Prompt-json.promppt terlihat seperti berikut. Perhatikan bagaimana output menentukan untuk menggunakan JSON. Ubah prompt dan properti untuk kebutuhan Anda.
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": ""}
Untuk informasi lebih lanjut tentang petunjuk
Pilih pola dasar proyek rantai . Kemudian buka opsi.
? 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
File proyek.yaml yang dihasilkan.
---
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-1Bidang properti dalam poin file Project.YAML di atas ke indeks dalam file properties.json di bawah ini. File ini memungkinkan Anda untuk dengan mudah mengubah input tes.
{
"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 "
]
}Alat ini akan mengganti planet "Bumi" dan tindakan "mendarat di planet" ke dalam cerita yang cepat di bawah ini. Perhatikan bahwa AI akan menghasilkan nama karakter dan paragraf pertama cerita.
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": ""}
Alat ini sekarang akan melewati nama kapten yang dikembalikan dan cerita dari prompt pertama ke aksi pengguna . Kami akan mendapatkan kembali tindakan yang dilakukan karakter.
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": ""}
Sekarang kita akan menjalankan cerita. Lagi lagi tapi kali ini kita akan memiliki nama kapten dan tindakan selanjutnya yang dia lakukan.
Berikut adalah output sampel dari menjalankan aktual
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.
Perhatikan bahwa rantai rantai sama dengan jumlah paragraf yang kami miliki dalam output. Jika kami menginginkan paragraf lain, kami akan menetapkan Chainruns menjadi 3. Jika kami telah menetapkan blockruns ke 5, kami akan menghasilkan 5 cerita yang berbeda.
Untuk informasi lebih lanjut tentang rantai
Untuk menghasilkan laporan HTML, tambahkan pelaporangptplugin sebagai blok terakhir. Di bawah BlockID, tambahkan ID blok sebelumnya yang ingin Anda tambahkan ke laporan yang dihasilkan.
---
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 Laporan akan menampilkan seluruh obrolan untuk eksekusi blok yang dikonfigurasi.

Untuk informasi lebih lanjut tentang pelaporan
udara --help
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.
Untuk membersihkan proyek, jalankan yang berikut ini
Bersih Udara
Ini menghapus direktori output untuk proyek.
Menjalankan panggilan openai dengan alat bisa mahal jika Anda salah mengkonfigurasi. Untuk menentukan berapa banyak panggilan openai yang akan dibuat proyek, jalankan perintah berikut
Hitungan Udara
atau untuk penghitungan blok tertentu
Air Count -B MyBlockId
Itu akan menghasilkan
Project: product-summary-2.8
Total OpenAPI Calls would be 12
Jika Anda ingin tahu bahwa proyek Anda melakukan sebelum mengeluarkan biaya untuk Openai, gunakan bendera 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