แอพนาโนเป็นแอพพลิเคชั่นเล็ก ๆ ที่สามารถฝังอยู่ในบอทนาโน เช่นเดียวกับที่มนุษย์สามารถขยายความสามารถของพวกเขาด้วยการเข้าถึงเครื่องมือเช่นประแจเครื่องคิดเลขเครื่องอ่านหน้าจอหรือการเข้าถึงอินเทอร์เน็ตบอทนาโนสามารถเพิ่มความสามารถเมื่อติดตั้งแอพนาโน
แอพนาโนสามารถเขียนได้ใน Lua, Fennel หรือ Clojure ที่เก็บเฉพาะนี้ได้เลือกที่จะใช้ Clojure สำหรับแอพนาโน
ติดตั้งและตั้งค่า Nano Bots CLI และ Babashka แล้ว:
git clone https://github.com/gbaptista/nano-apps.git
cd nano-apps
bb tasks/generate-cartridge.clj cartridges/template.yml cartridge.yml
# Cartridge successfully generated at cartridge.yml
nb cartridge.yml - repl ?> What day of the week is it today?
date-and-time {}
{:date-time 2023-12-02T14:19:18-03:00, :timezone America/Sao_Paulo}
Today is Saturday.
?> |
คุณสามารถออกจาก exit การพิมพ์
ให้ GNU octave สำหรับคณิตศาสตร์เลขคณิตและสัญลักษณ์รวมถึงการดำเนินงานขั้นพื้นฐานและการคำนวณที่ซับซ้อนเช่นอนุพันธ์และอินทิกรัล
การติดตั้ง GNU Octave:
sudo pacman -S octave # Arch / Manjaro
sudo apt-get install octave # Debian / Ubuntu / Raspberry Pi OS
sudo dnf install octave # Fedora / CentOS / RHEL หลังจากการติดตั้งคุณต้องติดตั้งแพ็คเกจ symbolic : pkg install -forge symbolic
octave GNU Octave, version 6.4.0
octave:1> pkg install -forge symbolic
For information about changes from previous versions of the symbolic package, run 'news symbolic'.
octave:2>
ตัวอย่างอนุพันธ์:
?> What is the derivative of the function f(x) = 3x^2 + 5x + 2 with respect to x?
advanced-calculator {"expression":"syms x; diff(3*x^2 + 5*x + 2)"}
Symbolic pkg v3.1.1: Python communication link active, SymPy v1.11.1.
ans = (sym) 6⋅x + 5
The derivative of the function f(x) = 3x^2 + 5x + 2 with respect to x is 6x + 5.
?> Find the derivative of the function g(x) = e^(2x) – cos(x) with respect to x.
advanced-calculator {"expression":"syms x; diff(exp(2*x) - cos(x))"}
Symbolic pkg v3.1.1: Python communication link active, SymPy v1.11.1.
ans = (sym)
2⋅x
2⋅ℯ + sin(x)
The derivative of the function g(x) = e^(2x) – cos(x) with respect to x is 2e^(2x) + sin(x).
?> |
ตัวอย่างอินทิกรัล:
?> What is the indefinite integral of the function f(x) = 1/(x^2 + 1) with respect to x?
advanced-calculator {"expression":"syms x; int(1/(x^2 + 1))"}
Symbolic pkg v3.1.1: Python communication link active, SymPy v1.11.1.
ans = (sym) atan(x)
The indefinite integral of the function f(x) = 1/(x^2 + 1) with respect to x is atan(x) + C,
where C is the constant of integration.
?> Calculate the definite integral of g(x) from x = 0 to x = pi of g(x) = sin^2(x).
advanced-calculator {"expression":"syms x; int(sin(x)^2, 0, pi)"}
Symbolic pkg v3.1.1: Python communication link active, SymPy v1.11.1.
ans = (sym)
π
─
2
The definite integral of g(x) = sin^2(x) from x = 0 to x = pi is pi/2.
?> |
ให้การเข้าถึงพื้นฐานของนาฬิกาช่วยให้ Nano Bot สามารถเข้าถึงวันที่และเวลาได้
ตัวอย่าง:
?> What time is it?
date-and-time {}
{:date-time 2023-12-02T12:22:01-03:00, :timezone America/Sao_Paulo}
The current time is 12:22:01 PM in the timezone America/Sao Paulo.
?> What day of the week is it today?
Today is Saturday.
?> |
จัดเตรียม PlayerCTL สำหรับการควบคุมเครื่องเล่นสื่อที่ใช้ข้อกำหนดอินเตอร์เฟส MPRIS D-BUS
การติดตั้ง playerctl:
sudo pacman -S playerctl # Arch / Manjaro
sudo apt-get install playerctl # Debian / Ubuntu / Raspberry Pi OS
sudo dnf install playerctl # Fedora / CentOS / RHELตัวอย่าง:
?> which players do i have?
media-player-control {"command":"list"}
chromium.instance12231
plasma-browser-integration
You have two media players available for control:
1. Chromium, with an instance ID of 12231.
2. Plasma Browser Integration.
These players can be controlled with play, pause,
stop, and various other media control commands.
?> what's playing on plasma?
media-player-control {"command":"metadata","player":"plasma-browser-integration"}
plasma-browser-integration kde:mediaSrc blob:https://www.youtube.com/9c1414f1-5ae7-43d3-a7e2-45f519cdb0a9
plasma-browser-integration kde:pid 12231
plasma-browser-integration mpris:artUrl https://i.ytimg.com/vi/1JNmz17gnMw/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDr0ppBmCZeRzvIfsuDAY7BxKYeBQ
plasma-browser-integration mpris:length 350041000
plasma-browser-integration mpris:trackid '/org/kde/plasma/browser_integration/1337'
plasma-browser-integration xesam:artist Polyphia
plasma-browser-integration xesam:title Polyphia - Ego Death feat. Steve Vai (Official Music Video)
plasma-browser-integration xesam:url https://www.youtube.com/watch?v=1JNmz17gnMw
Currently, on Plasma Browser Integration, the track
"Ego Death" by Polyphia featuring Steve Vai is playing.
This is the official music video on YouTube.
The artwork for the track is available as well, which
you would recognize from the video thumbnail on YouTube.
?> pause the song
media-player-control {"command":"pause","player":"plasma-browser-integration"}
The song has been paused on Plasma Browser Integration.
If you wish to resume playback, just let me know!
?> resume playing
media-player-control {"command":"play","player":"plasma-browser-integration"}
The song is now playing again on Plasma Browser Integration.
Enjoy the music!
?> go back to the beginning of the song
media-player-control {"command":"position","player":"plasma-browser-integration","option":"0"}
I've reset the song to the beginning for you.
?> turn up the volume to the maximum
media-player-control {"command":"volume","player":"plasma-browser-integration","option":"1.0"}
?> |
มันให้ความสามารถในการสร้างตัวเลขสุ่ม
ตัวอย่าง:
?> Choose a random number.
random-number {"from":1,"to":100}
53
The random number chosen is 53.
?> I would like a random number between 350 and 480.
random-number {"from":350,"to":480}
382
The random number chosen between 350 and 480 is 382.
?> |
☠ คำเตือน: แอพนาโนนี้อาจดำเนินการอันตรายและทำลายล้างในระบบ ระวังด้วย
ให้วิธีการโต้ตอบกับระบบคอมพิวเตอร์และข้อมูลโดยการดำเนินการคำสั่งเชลล์คล้ายกับที่ใช้ในเทอร์มินัล Linux สามารถส่งคำสั่งไปยังซอฟต์แวร์แยกข้อมูลและดำเนินการต่างๆ
ตัวอย่าง:
?> How much space do I have on my disk?
sh {"command":["df","-h","--output=avail","/"]}
Avail
478G
You have 478 GB of available space on your disk.
?> How many cores does my CPU have?
sh {"command":["nproc"]}
8
Your CPU has 8 cores.
?> Am I connected to the Internet?
sh {"command":["ping","-c","1","8.8.8.8"]}
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=16.1 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 16.126/16.126/16.126/0.000 ms
Yes, you are connected to the Internet. I successfully pinged the
IP address 8.8.8.8 (Google's DNS server) and received a response.
?> |
จัดเตรียม GNU BC สำหรับการคำนวณทางคณิตศาสตร์ มันสามารถจัดการเพิ่มเติมการลบการคูณการหารและการดำเนินงานโมดูลัสรวมถึงการขยายและฟังก์ชั่นต่าง ๆ ทั้งหมดมีความแม่นยำโดยพลการ
การติดตั้ง GNU BC:
sudo pacman -S bc # Arch / Manjaro
sudo apt-get install bc # Debian / Ubuntu / Raspberry Pi OS
sudo dnf install bc # Fedora / CentOS / RHELตัวอย่าง:
?> How much is 10 plus 15?
simple-calculator {"expression":"10+15"}
25
10 plus 15 equals 25.
?> What is the remainder when dividing 28 by 6?
simple-calculator {"expression":"28 % 6"}
4
The remainder when dividing 28 by 6 is 4.
?> Calculate if 3 is less than 4.
simple-calculator {"expression":"3<4"}
1
The calculation confirms that 3 is less than 4.
?> What is 3 divided by 2?
simple-calculator {"expression":"scale=1; 3/2"}
1.5
3 divided by 2 equals 1.5.
?> |
ให้การพยากรณ์อากาศและสภาวะปัจจุบันรวมถึงอุณหภูมิความเร็วลมและความชื้นจาก WTTR.IN นอกจากนี้ยังมีข้อมูลทางดาราศาสตร์เช่นช่วงเวลาแห่งพระอาทิตย์ขึ้นและพระอาทิตย์ตกและรายละเอียดเกี่ยวกับดวงจันทร์
ตัวอย่าง:
?> What's the current temperature in New York?
weather {"location":"New York"}
{:current_condition [{:FeelsLikeC 4, :windspeedMiles...
The current temperature in New York is 6°C (43°F).
?> Tell me about the moon in Cairo today.
weather {"location":"Cairo"}
{:current_condition [{:FeelsLikeC 25, :windspeedMiles...
In Cairo today, the moon is in a Waning Gibbous phase with 79% illumination.
Moonrise is at 9:30 PM and moonset is at 10:57 AM (local time).
?> Should I wear sunglasses or carry an umbrella in Rome today?
weather {"location":"Rome"}
{:current_condition [{:FeelsLikeC 12, :windspeedMiles...
You should wear sunglasses in Rome today, as the weather is partly cloudy with
a 0.0 mm precipitation forecast, indicating no need for an umbrella.
?> What's the likelihood of me seeing a rainbow this afternoon in Rio de Janeiro?
weather {"location":"Rio de Janeiro"}
{:current_condition [{:FeelsLikeC 29, :windspeedMiles...
The likelihood of seeing a rainbow this afternoon in Rio de Janeiro is
low as the weather is partly cloudy with no precipitation reported.
Rainbows typically require rain combined with sunshine.
?> Is it a good day for kite flying in Sydney based on wind conditions?
weather {"location":"Sydney"}
{:current_condition [{:FeelsLikeC 18, :windspeedMiles...
Yes, it's a good day for kite flying in Sydney.
The weather is clear with wind speeds of 9 km/h (6 miles per hour).
?> |
เพียงคัดลอกและวางโฟลเดอร์ภายใน /apps ที่คล้ายกับสิ่งที่คุณพยายามทำ โครงสร้างคือ:
app.clj : ซอร์สโค้ดแอพนาโนspecification.yml : ข้อกำหนดแอพนาโนสำหรับบอทนาโนtest.clj : การทดสอบแอพนาโนนอกจากนี้:
README.md : readme สำหรับมนุษย์ไม่ได้ใช้ที่อื่นเพียงเพื่อปรับปรุง readme นี้จากเทมเพลตพื้นฐานสร้างตลับหมึกที่มีแอพนาโนทั้งหมดรวมอยู่ด้วย:
bb tasks/generate-cartridge.clj [CARTRIDGE-TEMPLATE] [OUTPUT-FILE]
# If you don't want to include your private Nano Apps:
bb tasks/generate-cartridge.clj [CARTRIDGE-TEMPLATE] [OUTPUT-FILE] --no-private
bb tasks/generate-cartridge.clj cartridges/template.yml cartridge.yml
# => cartridge.yml
bb tasks/generate-cartridge.clj cartridges/template.yml cartridge.yml --no-private
# => cartridge.ymlหลังจากสร้างตลับหมึกแล้วเมื่อพิจารณาว่าคุณมี Nano Bots CLI คุณสามารถลองได้ทันที:
nb cartridge.yml - repl
?> what time is it?
date-and-time {}
{:date-time 2023-12-02T14:10:05Z, :timezone UTC}
The current time in UTC is 14:10:05 on December 2, 2023.
?> |
คุณสามารถออกจาก exit การพิมพ์
รันการทดสอบทั้งหมด:
bb tasks/run-tests.cljรันการทดสอบแต่ละครั้ง:
bb apps/simple-calculator/test.cljรันการทดสอบทั้งหมดไม่รวมแอพนาโนส่วนตัว:
bb tasks/run-tests.clj --no-private อัปเดตไฟล์ template.md จากนั้น:
bb tasks/generate-readme.clj เคล็ดลับสำหรับการอัปเดต README.md โดยอัตโนมัติเมื่อ template.md เปลี่ยนแปลง:
sudo pacman -S inotify-tools # Arch / Manjaro
sudo apt-get install inotify-tools # Debian / Ubuntu / Raspberry Pi OS
sudo dnf install inotify-tools # Fedora / CentOS / RHEL
while inotifywait -e modify -e create template.md apps/ * /README.md ; do bb tasks/generate-readme.clj ; doneเคล็ดลับสำหรับ Markdown Live Preview:
pip install -U markdown_live_preview
mlp README.md -p 8076bb tasks/cljfmt-fix.clj คุณสามารถสร้างแอพนาโนส่วนตัวที่จะไม่มุ่งมั่นไปยังที่เก็บโดยใช้แอป user@app :
apps/your-name@your-app/app.clj
เช่นเดียวกับเทมเพลตคาร์ทริดจ์ส่วนตัว:
cartridges/[email protected]
คุณสามารถยกเว้นแอพนาโนส่วนตัวของคุณจากการสร้างตลับหมึกด้วย:
bb tasks/generate-cartridge.clj cartridges/template.yml cartridge.yml --no-privateรันการทดสอบทั้งหมดไม่รวมแอพนาโนส่วนตัว:
bb tasks/run-tests.clj --no-private แอพนาโนได้รับการออกแบบเป็นส่วนหนึ่งของบอทนาโนดังนั้นจึงเป็นเรื่องสำคัญที่จะต้องทำความคุ้นเคยกับข้อกำหนดและหลักการของ Nano Bots: ข้อมูลจำเพาะของ Nano Bots
แอพนาโนนั้นดีพอ ๆ กับความสามารถของผู้ให้บริการ AI ในการใช้ประโยชน์จากมัน ดังนั้นในฐานะหลักการหลักทุกสิ่งที่คุณได้เรียนรู้เกี่ยวกับ วิศวกรรมที่รวดเร็ว ควรได้รับการพิจารณาและนำไปใช้กับการพัฒนาแอพนาโนโดยเฉพาะอย่างยิ่งเมื่อเขียนข้อมูลจำเพาะของพวกเขา:
บางครั้งคุณอาจรู้สึกว่า "มันซับซ้อนเกินไป" หรือ "มันจะไม่เป็นประโยชน์" หรือ "ทำไมมันถึงใช้สิ่งนี้" ฯลฯ คุณอาจประหลาดใจกับวิธีการสร้างสรรค์แอพนาโนที่ใช้โดยรุ่น
สำหรับตัวอย่างที่เป็นรูปธรรมการควบคุมเครื่องเล่นสื่อมีคำสั่งที่คุณอาจคิดว่าไม่คุ้มค่า แต่ถ้าคุณใช้เวลาเล่นไปรอบ ๆ คุณจะมีช่วงเวลา "ว้าว" มากมายเกี่ยวกับวิธีที่โมเดลใช้เพื่อให้บรรลุสิ่งที่คุณขอ
ดังนั้น ให้มันมีที่ว่าง ที่จะสร้างสรรค์และสำรวจอย่าระงับการทำงานเพียงเพราะคุณรู้สึกไม่แน่ใจ
แม้ว่า LLM จะมีความสามารถมากขึ้นในการจัดการข้อมูลจำนวนมาก แต่เราต้องพิจารณาสิ่งต่อไปนี้เมื่อพูดถึงโทเค็น:
หลีกเลี่ยงการให้เอาต์พุตที่มีความยาวโดยไม่จำเป็น คว้าโอกาสที่จะทำให้ผลลัพธ์ของคุณกระชับ ระวังเมื่อสร้างแอพนาโนที่สอบถามฐานข้อมูลหรือเรียกใช้คำสั่งเนื่องจากสามารถสร้างเอาต์พุตที่มีความยาวได้อย่างไม่คาดคิด
เมื่อใช้แอพนาโนเป็นพร็อกซีสำหรับซอฟต์แวร์ยอดนิยมตรวจสอบให้แน่ใจว่าผลลัพธ์นั้นซื่อสัตย์ต่อซอฟต์แวร์จริง แบบจำลองมีเหตุผลดีกว่าเมื่อผลลัพธ์เป็นสิ่งที่คาดหวังจากโปรแกรม
ตัวอย่างหากแอพนาโนของคุณเป็นพร็อกซีสำหรับซอฟต์แวร์ GNU Octave เอาท์พุทที่คาดหวังสำหรับการดำเนินงานจะเป็น:
ans = 6
มันอาจจะเป็นการล่อลวงให้สั้นลงเพื่อกลับมาเพียง 6 แทน ans = 6 อย่าทำอย่างนั้น; รักษาเอาต์พุตดั้งเดิมไว้ตามที่โมเดลเรียนรู้ที่จะคาดหวังในระหว่างการฝึกอบรม
รักษาข้อผิดพลาดอย่างกระชับ (เอาต์พุตที่กระชับ) และเป็นประโยชน์ (วิศวกรรมที่รวดเร็ว)
เมื่อใช้แอพนาโนเป็นพร็อกซีสำหรับซอฟต์แวร์ยอดนิยมให้จัดลำดับความสำคัญของการแบ่งปันเอาต์พุตข้อผิดพลาดดั้งเดิมจากซอฟต์แวร์ (เอาท์พุทความซื่อสัตย์) ซอฟต์แวร์บางตัวสร้างร่องรอยสแต็กข้อผิดพลาดที่ยาวนาน ในสถานการณ์นี้เป็นการดีที่สุดที่จะให้ข้อความสั้น ๆ ที่กำหนดเองทางเลือกหรือ จำกัด ขนาดผลลัพธ์โดยไม่ต้องเสียสละรายละเอียดที่จำเป็น ความคงทนของเอาต์พุตสมดุลพร้อมเอาต์พุตที่กระชับ
การส่งคืน () เป็นผลลัพธ์ของฟังก์ชั่นอาจทำให้โมเดล OpenAI ร้องขอให้ฟังก์ชั่นทำงานอีกครั้งซึ่งอาจนำไปสู่การวนรอบที่ไม่มีที่สิ้นสุด
นี่คือโครงการทดลองขั้นต้น แอพนาโนอาจเป็นอันตรายดังนั้นโปรดระวังสิ่งที่คุณพยายามสร้าง พวกเขาสามารถดำเนินการทำลายล้างบนคอมพิวเตอร์ของคุณ นอกจากนี้จงระวังงบประมาณของคุณ: ให้แน่ใจว่าคุณตรวจสอบและงบประมาณผู้ให้บริการที่คุณใช้ แอพนาโนอาจสร้างเนื้อหาที่ยาวนานโดยไม่คาดคิดหรือลูปที่ไม่มีที่สิ้นสุด/ยาวเกินไปซึ่งอาจทำให้ค่าใช้จ่ายของคุณพุ่งสูงขึ้น
ซอฟต์แวร์นี้มีการแจกจ่ายภายใต้ใบอนุญาต MIT ซึ่งรวมถึงข้อจำกัดความรับผิดชอบของการรับประกัน นอกจากนี้ผู้เขียนไม่รับผิดชอบต่อความเสียหายหรือค่าใช้จ่ายใด ๆ ที่อาจเกิดขึ้นจากการใช้โครงการทดลองขั้นต้นนี้ ใช้แอพนาโนตามความเสี่ยงของคุณเอง