GISH เป็นอินเทอร์เฟซบรรทัดคำสั่ง (CLI) ที่โต้ตอบกับ OpenAI GPT ตามอนุสัญญา UNIX และเสนอชุดคุณสมบัติที่หลากหลายผ่านธง เป็นสิ่งสำคัญที่จะต้องทราบว่าต้องใช้บัญชี OpenAI ที่ชำระเงินและคีย์ API เพื่อใช้ GISH
Gish เสนอคุณสมบัติต่อไปนี้:
#import
#diff
หรือ FLAG -d
npx gish-gpt
หรือ
npm install gish-gpt
node_modules/.bin/gish
ทางเลือกแทนที่ขั้นตอนที่ 3 ด้วย NPM dev เพื่อทำการเปลี่ยนแปลงรหัสและ
dist/index.js
dist/index.js
ที่ไหนสักแห่งในเส้นทางของคุณ หรือสร้างนามแฝง # gish tell me a joke
Why was the math book sad? Because it had too many problems.
# gish "What is the population of the city of London?".
The population of the City of London is approximately9 million, as of 2021.
หากไม่มีเครื่องหมายคำพูดเชลล์จะตีความเครื่องหมายคำถามในคำขอที่สองและทำให้เกิดข้อผิดพลาด
อินพุต PIPED:
#echo "What is the population of the city of London?" | gish
The estimated population of the city of London is around 9 million people.
# gish.
> tell me a joke
Why did the tomato turn red? Because it saw the salad dressing!
สิ่งนี้คล้ายกับการพิมพ์ "Python" หรือ "Node" ที่บรรทัดคำสั่ง
gist < foo
เนื้อหาของฟูอยู่ที่ไหน
tell me a joke
gish --help
แสดงตัวเลือกที่แตกต่างทั้งหมดgish tell me a joke
จะส่งคำขอgish "what is the population of San Francisco?".
คุณต้องมีคำพูดเพื่อหลีกเลี่ยงข้อผิดพลาดของเชลล์gish -e
ทำให้คุณอยู่ในบรรณาธิการของคุณและส่งเนื้อหาเมื่อคุณทำเสร็จแล้ว หากต้องการยกเลิกไม่ได้สร้างไฟล์หรือว่างเปล่าgish -e foo.txt
ทำเช่นเดียวกัน แต่ทำงานกับไฟล์ที่มีอยู่gish -h [num]
แสดงประวัติศาสตร์ NUM เป็นตัวเลือกและค่าเริ่มต้นเป็น 20gish -i foo
ส่งเนื้อหาของ Foo เทียบเท่ากับ cat foo | gish
.gish -m gpt-4
ระบุโมเดลgish -p foo
ใช้ Foo เป็นพรอมต์ในการแชท ธงหรืออาร์กิวเมนต์อื่น ๆ ใช้เพื่อส่งคำขอจริง แต่นี่เป็นพื้นหลัง ดู https://platform.openai.com/docs/guides/chat Gish ตั้งค่าพรอมต์นี้เป็นครั้งแรกในการแชทด้วยบทบาทของ "ระบบ"gish -s foo.ts
บันทึกเอาต์พุตเป็น foo.ts เมื่อสร้างรหัสผู้ใช้จะต้องใช้พรอมต์ที่สร้างผลลัพธ์ที่เหมาะสม ดูการแจ้งเตือน/การเข้ารหัสสำหรับตัวอย่างgish -d foo.ts
แตกต่างผลลัพธ์กับไฟล์นี้ ต้องการ -sgish -c [num]
เปิดใช้งานโหมดการแชทและอ้างถึงคำขอ NUM, ค่าเริ่มต้นเป็นโหมดก่อนหน้า ดูส่วนแชทสำหรับรายละเอียดเพิ่มเติมgish -g
สร้างหลายไฟล์เพื่อสร้างแอปพลิเคชันเต็ม ดูส่วนการสร้างสำหรับรายละเอียดเพิ่มเติมgish -x
อาร์กิวเมนต์พิเศษที่จะส่งผ่านไปยัง GPT ตัวอย่าง: -x '"อุณหภูมิ" = 0.5: "max_tokens" = 500' เช่นเดียวกับในเชลล์ของคุณ -H หรือ -ประวัติศาสตร์แสดงประวัติของคำขอของคุณ พารามิเตอร์ NUM ที่เป็นตัวเลือกระบุจำนวนองค์ประกอบ ค่าเริ่มต้นคือ 20
โหมดแชทให้ประสบการณ์ที่คล้ายกันกับ https://platform.openai.com/chat ซึ่งคุณสามารถอ้างถึงคำขอก่อนหน้านี้
# gish what is the capital of japan
The capital of Japan is Tokyo.
# gish -c population
The estimated population of Tokyo, Japan as of2021 is approximately 13.9 million people.
การใช้คุณสมบัติประวัติคุณสามารถดูตำแหน่งของคำขอในประวัติและส่งผ่านในพารามิเตอร์ -C
# gish tell me a joke
Why did the tomato turn red ? Because it saw the salad dressing !
# gish tell me a one line story
She found love in the most unexpected place.
# gish -h 2
892: tell me a joke
893: tell me a one line story
# gish -c 892 another
Why did the bicycle fall over ? Because it was two-tired !
ดู [DHAT API DOCS] (https://platform.openai.com/docs/api-reference/chat) สำหรับรายการ Flagas ที่คุณสามารถใช้ได้ คุณลักษณะนี้มีไว้สำหรับผู้ใช้ขั้นสูง แต่โดยทั่วไป API จะผิดพลาดหากคุณผ่านการตั้งค่าสถานะที่ไม่รองรับ
คำเตือน สตริงที่คุณผ่าน จะต้อง ถูกต้อง JSON ตรวจสอบให้แน่ใจว่ามีสตริงใด ๆ ที่แนบมาในคำพูดสองครั้งทั้งสองด้านของ ':' นี่คือ JSON ไม่ใช่ JavaScript! ตัวอย่าง:
# gish -x '"temperature":0.5,"max_tokens":5' tell me a joke
Why did the tomato turn
ทำให้มันตัดการตอบสนองหลังจาก 5 โทเค็น
chat
และคำขอเข้าสู่โหมดแชท พิมพ์ทางออกเพื่อออกจากโหมดแชท พิมพ์ ประวัติ ด้วยหมายเลขเสริมเพื่อดูประวัติ ค่าเริ่มต้นคือ 20
โหมดแชทให้ประสบการณ์ที่คล้ายกันกับ https://platform.openai.com/chat ซึ่งคุณสามารถอ้างถึงคำขอก่อนหน้านี้
> 10 miles to km
16.0934 km.
> chat how about 40
40 miles is equal to64.3736 kilometers.
Chat > how about 50
50 miles is equal to80.4672 kilometers.
Chat > exit
> how about 30
30 is a positive integer that comes after29 and before 31.
chat 876 another
ใช้คำสั่ง #import
ในไฟล์อินพุตของคุณเพื่อรวมพรอมต์หรือความคิดเห็น/ข้อความที่คุณต้องการให้ CHATGPT ตอบสนอง ตัวอย่าง
#import ~/work/gish/tasks/coding.txt
The above program prints hello world. Change it to print goodbye world.
#import hello.ts
นี่คือเนื้อหาของ tasks/coding.txt
:
I want you to act as a coding collaborator. I will ask you software questions and you will answer with code.
Your response for this request needs to be code and nothing else.
Only provide comments if they provide important extra information and they should be brief and to the point. The contents should be in the code as comments at the top of the file.
---
นี่คือเวิร์กโฟลว์ทั่วไปเมื่อใช้ GISH สำหรับการเข้ารหัส:
ใช้ตัวเลือก #diff
เมื่อคุณต้องการให้ GPT ทำการเปลี่ยนแปลงไฟล์แล้วแตกต่าง:
#import ~/work/gish/tasks/coding.txt
In the following file, document the code better
#diff settings.ts
กระบวนการนี้คล้ายกับ #import
แต่ยังช่วยให้แอปทราบว่าผู้ใช้กำลังแก้ไขไฟล์ เมื่อรหัสถูกสร้างขึ้นแล้วคำสั่ง DIFF ที่กำหนดไว้ใน settings.ts
จะถูกเปิดตัวในไฟล์ต้นฉบับและสร้าง สำหรับการเปลี่ยนแปลงที่ซับซ้อน Copilot อาจทำงานได้ดีขึ้น
ด้วยพรอมต์ที่เหมาะสมเช่น [เว็บแอปพลิเคชัน] (งาน/webapp.txt) คุณสามารถรับ LLM, GPT-4 สำหรับสิ่งนี้ แต่การทดลองและดูว่าอะไรเหมาะกับคุณ เพียงแค่สร้างไฟล์อินพุต
#import tasks/webapp.txt
Generate Conway's game of life.
Include on the page, the instructions on how to play the game.
แล้ววิ่ง
gish -m gpt-4 -g life -i /input
ส่งผลให้เกมแห่งชีวิตในไดเรกทอรี "ชีวิต"
คำเตือน
โปรดทราบว่าการใช้วิธีการนี้ใช้งานง่ายจำนวนมากโดยเฉพาะกับ GPT-4 ดังนั้นค่าใช้จ่ายสามารถเพิ่มขึ้นได้
ดู [ตัวอย่าง] (ตัวอย่าง) DIR สำหรับวิธีการใช้ gish เพื่อ:
นี่คือตัวอย่างเชลล์สคริปต์ที่ใช้ GISH เพื่อสร้างข้อความ GIT COMMEN
#! /bin/bash
out= " The following is the output of git diff "
out+= ` git diff $* `
out+= " ----------------------------- "
out+= " The following is the output of git status "
out+= ` git status --untracked-files=no $* `
out+= " ----------------------------- "
out+= " based on the above provide a commit message "
git commit -e -m " ` echo $out | gish --no-stats ` " $*
ไฟล์บันทึก ~/.gish/history.json ทำงานเป็นบันทึกการสนทนาของคุณด้วย chatgpt เนื่องจากเป็นไฟล์มาตรฐานคุณสามารถใช้ตัวแก้ไขหรือเพจเจอร์เพื่อดูประวัติของการโต้ตอบของคุณกับ CHATGPT จึงมี:
คล้ายกับคำสั่ง Linux เช่น Cat และ Echo ต่อไปนี้เป็นวิธีที่ GISH จัดลำดับความสำคัญอาร์กิวเมนต์และธง:
โดยค่าเริ่มต้น Gish จะแสดงสถิติสำหรับคำขอของคุณ:
gish tell me a joke --no-stream
Why don't scientists trust atoms?
Because they make up everything.
Tokens: 26 Cost: $0.00005 Elapsed: 1.198 Seconds
ค่าใช้จ่ายขึ้นอยู่กับสมมติฐานที่ว่าคุณใช้ GPT3.5 ที่ $ 0.02 ต่อ 1,000 โทเค็น *ตรวจสอบตัวเลขอีกครั้งก่อนที่จะพึ่งพาพวกเขา เมื่อใช้สตรีมมิ่ง API ไม่ได้ให้จำนวนโทเค็นแก่เราดังนั้นเราจึงต้องคำนวณสิ่งเหล่านี้ด้วยตัวเองซึ่งอาจปิดได้