GPT 명령을 실행하기위한 명령 줄 도구. 이 도구는 프롬프트 배제, 프롬프트 체인 및 Chatgpt 플러그인을 지원합니다.
이 도구를 사용하십시오
OpenAI API 키를 만들어야합니다. 계정이 있으면 여기에서 키를 만들 수 있습니다.
https://platform.openai.com/account/api-keys
API 키를 다른 사람과 공유하지 않거나 브라우저 또는 기타 클라이언트 측 코드에 노출하지 마십시오. 누군가가 키를 사용하는 경우 요금이 부과됩니다. 공개 저장소에 키를 확인하지 마십시오.
API 키가 포함 된 파일을 만듭니다 (아래는 실제가 아님). 이 예에서. 파일 API_Key의 이름을 지정하고 키를 추가합니다.
sk-gKtTxOumv4orO6cfWlh0ZK
다트가 설치되어 있는지 확인하십시오. 아래 링크에서 지침을 따르십시오.
https://dart.dev/get-dart
설치 후 다음 명령으로 GPT 프로그램을 설치할 수 있습니다.
다트 펍 글로벌 활성화 GPT
다음은 지원되는 사용 사례입니다
생성 프로젝트 명령을 실행하십시오
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에 대한 응답을 조롱 할 수 있습니다. 이 프로젝트는 https://github.com/openai/plugins-quickstart의 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위 프로젝트 의 속성 필드. 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": ""}
이 도구는 이제 반환 된 선장의 이름과 첫 번째 프롬프트에서 user-action.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.
체인 실행은 출력에있는 단락 수와 동일합니다. 우리가 또 다른 단락을 원한다면, 우리는 체인 런을 3으로 설정할 것입니다. 만약 우리가 블록 런을 5로 설정했다면, 우리는 5 개의 다른 이야기를 생성했을 것입니다.
체인에 대한 자세한 정보
HTML 보고서를 생성하려면 ReportingGptPlugin을 마지막 블록으로 추가하십시오. Blockid에서 생성 된 보고서에 추가하려는 이전 블록 ID를 추가하십시오.
---
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 플래그를 사용하십시오.
에어 런 -드라이 런
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