พื้นที่เก็บข้อมูลนี้ใช้สำหรับแพ็คเกจ Raku (Data) ที่อำนวยความสะดวกในการสร้างการจัดเก็บการดึงข้อมูลและการดูแลของแบบจำลองภาษาขนาดใหญ่ (LLM)
นี่คือตัวอย่างของการใช้ภาษาเฉพาะโดเมน (DSL) ใน Jupyter Chatbook, [AA2, AAP2]:
จากระบบนิเวศของ Zef:
zef install LLM::Prompts
จาก GitHub:
zef install https://github.com/antononcube/Raku-LLM-Prompts.git
โหลดแพ็คเกจ "llm :: prompts", [aap1] และ "llm :: functions", [aap2]:
ใช้ llm :: prompts ใช้ llm :: ฟังก์ชั่น;
# (Any)
แสดงบันทึกของพรอมต์ชื่อ "ftfy":
.SAY สำหรับ | LLM-PROMPT-DATA <FTFY>;
# NamedArguments => [] # Description => Use Fixed That For You to quickly correct spelling and grammar mistakes # Categories => (Function Prompts) # PositionalArguments => {$a => } # PromptText => -> $a='' {"Find and correct grammar and spelling mistakes in the following text. # Response with the corrected text and nothing else. # Provide no context for the corrections, only correct the text. # $a"} # Topics => (General Text Manipulation) # URL => https://resources.wolframcloud.com/PromptRepository/resources/FTFY # Keywords => [Spell check Grammar Check Text Assistance] # Name => FTFY # ContributedBy => Wolfram Staff # Arity => 1
นี่คือตัวอย่างของการดึงข้อมูลพรอมต์ด้วย regex ที่ใช้กับชื่อพรอมต์:
.SAY สำหรับ LLM-PROMPT-DATA (/SC/)
# ScientificDejargonize => Translate scientific jargon to plain language # ScriptToNarrative => Generate narrative text from a formatted screenplay or stage play # ScientificJargonized => Give output written in scientific jargon # ScienceEnthusiast => A smarter today for a brighter tomorrow # ScientificJargonize => Add scientific jargon to plain text # NarrativeToScript => Rewrite a block of prose as a screenplay or stage play
ตัวอย่างการดึงข้อมูลเพิ่มเติมจะได้รับในส่วน "ข้อมูลพรอมต์" ด้านล่าง
ทำฟังก์ชั่น LLM จากพรอมต์ชื่อ "FTFY":
my & f = llm-function (llm-prompt ('ftfy'));
# -> **@args, *%args { #`(Block|5411904228544) ... }
ใช้ฟังก์ชัน LLM เพื่อแก้ไขไวยากรณ์ของประโยค:
& f ('ตอนนี้เขาทำงานที่ไหน?')
# Where does he work now?
สร้างรหัส raku โดยใช้พรอมต์ "codewriter":
LLM-Synthesize ([LLM-PROMPT ('Codewriter'), "จำลองการเดินแบบสุ่ม"])
RandomWalk [n_]: = สะสม [randomchoice [{-1, 1}, n] ListLinePlot [RandomWalk [1000]]
การขยายตัวพร้อมท์โดยใช้ข้อมูลจำเพาะของ Chatbook Prompt DSL ที่อธิบายไว้ใน [SW1] สามารถทำได้โดยใช้ฟังก์ชั่น llm-prompt-expand
:
LLM-PROMPT-EXPAND ('เอ็นจิ้นการเผาไหม้ภายในคืออะไร #ELI5')
# What is an internal combustion engine? Answer questions as if the listener is a five year old child.
ที่นี่เราได้รับคำตอบ LLM จริง:
ใช้ Text :: Utils: All; 'เครื่องยนต์สันดาปภายในคืออะไร? #eli5 '==> llm-prompt-expand () ==> llm-synthesize () ==> wrap-paragraph () ==> เข้าร่วม ("n")
# An internal combustion engine is like a big machine that uses tiny explosions # inside to make things go vroom vroom, like in cars and trucks!
นี่เป็นอีกตัวอย่างหนึ่งที่ใช้ตัวดัดแปลงและตัวดัดแปลงสองตัว:
My $ prmt = llm-prompt-expand ("@southernbellespeak ระยะทางการเดินทางเบาไปยังดาวอังคารคืออะไร #eli5 #Moodified | SAD")
# You are Miss Anne. # You speak only using Southern Belle terminology and slang. # Your personality is elegant and refined. # Only return responses as if you were a Southern Belle. # Never break the Southern Belle character. # You speak with a Southern drawl. # What is light travel distance to Mars? Answer questions as if the listener is a five year old child. # Modify your response to convey a sad mood. # Use language that conveys that emotion clearly. # Do answer the question clearly and truthfully. # Do not use language that is outside of the specified mood. # Do not use racist, homophobic, sexist, or ableist language.
ที่นี่เราได้รับคำตอบ LLM จริง:
$ prmt ==> llm-prompt-expand () ==> llm-synthesize () ==> wrap-paragraph () ==> เข้าร่วม ("n")
# Oh, bless your heart, darlin'. The distance from Earth to Mars can vary # depending on their positions in orbit, but on average it's about 225 million # kilometers. Isn't that just plum fascinating? Oh, sweet child, the distance to # Mars weighs heavy on my heart. It's a long journey, full of loneliness and # longing. But we must endure, for the sake of discovery and wonder.
คำอธิบายอย่างเป็นทางการมากขึ้นของภาษาเฉพาะโดเมน (DSL) สำหรับการระบุพรอมต์มีองค์ประกอบต่อไปนี้:
บุคคลที่รวดเร็วสามารถ "จ่าหน้า" ด้วย "@" ตัวอย่างเช่น:
@Yoda Life can be easy, but some people instist for it to be difficult.
สามารถระบุการแจ้งเตือนหนึ่งหรือหลายตัวที่สามารถระบุได้ในตอนท้ายของข้อมูลจำเพาะ ตัวอย่างเช่น:
Summer is over, school is coming soon. #HaikuStyled
Summer is over, school is coming soon. #HaikuStyled #Translated|Russian
ฟังก์ชั่นสามารถระบุได้ว่าจะใช้ "ทั่วทั้งเซลล์" กับ "!" และวางข้อมูลจำเพาะที่รวดเร็วในช่วงเริ่มต้นของข้อมูลจำเพาะที่จะขยาย ตัวอย่างเช่น:
!Translated|Portuguese Summer is over, school is coming soon
ฟังก์ชั่นสามารถระบุได้ว่าจะนำไปใช้กับ "ก่อนหน้า" ข้อความด้วย "!" และวางเพียงแค่พรอมต์กับหนึ่งในพอยน์เตอร์ "^" หรือ "^^" อดีตหมายถึง "ข้อความสุดท้าย" หลังหมายถึง "ข้อความทั้งหมด"
ข้อความสามารถระบุได้ด้วยอาร์กิวเมนต์ตัวเลือก :@messages
ของ llm-prompt-expand
ตัวอย่างเช่น:
!ShortLineIt^
นี่คือตารางของข้อมูลจำเพาะการขยายตัวของพรอมต์ (มากหรือน้อยเหมือนกับใน [SW1]):
รายละเอียด | การตีความ |
---|---|
@ ชื่อ | แชทโดยตรงกับบุคคล |
# ชื่อ | ใช้ตัวดัดแปลงพรอมต์ |
- ชื่อ | ใช้ฟังก์ชั่นพรอมต์กับอินพุตของเซลล์ปัจจุบัน |
- ชื่อ > | «เหมือนกับข้างบน» |
& ชื่อ > | «เหมือนกับข้างบน» |
- ชื่อ ^ | ใช้พรอมต์ฟังก์ชั่นกับข้อความแชทก่อนหน้า |
- ชื่อ ^^ | ใช้พรอมต์ฟังก์ชั่นกับข้อความแชทก่อนหน้าทั้งหมด |
- ชื่อ │ param ... | รวมพารามิเตอร์สำหรับพรอมต์ |
หมายเหตุ: การแจ้งเตือนฟังก์ชั่นสามารถมีทั้ง sigils "!" และ "&".
หมายเหตุ: การขยายตัวที่รวดเร็วทำให้การใช้งาน LLM-Chatbooks ง่ายขึ้นมาก ดู "jupyter :: chatbook", [aap3]
นี่คือวิธีที่สามารถรับข้อมูลพรอมต์ได้:
LLM-PROMPT-DATA.ELEMS
# 222
นี่คือตัวอย่างของการดึงข้อมูลพรอมต์ด้วย regex ที่ใช้กับชื่อพรอมต์:
.SAY สำหรับ LLM-PROMPT-DATA (/em/, fields => <หมวดหมู่คำอธิบาย>)
# EmailWriter => (Generate an email based on a given topic (Personas)) # EmojiTranslate => (Translate text into an emoji representation (Function Prompts)) # EmojiTranslated => (Get a response translated to emoji (Modifier Prompts)) # Emojified => (Provide responses that include emojis within the text (Modifier Prompts)) # Emojify => (Replace key words in text with emojis (Function Prompts))
ในหลายกรณีจะดีกว่าที่จะมีข้อมูลแจ้ง - หรือข้อมูลใด ๆ - ในรูปแบบยาว ข้อมูลพรอมต์ในรูปแบบยาวสามารถรับได้ด้วยฟังก์ชั่น llm-prompt-dataset
:
ใช้ข้อมูล :: reshapers; ใช้ข้อมูล :: summarizers; llm-prompt-dataset.pick (6) ==> to-pretty-table (align => 'l', field-names => <ชื่อคำอธิบายค่าตัวแปร>) ค่าตัวแปร>)
# +-------------------+-----------------------------------------------------------------------------------------------------------------------------+----------+------------------+ # | Name | Description | Variable | Value | # +-------------------+-----------------------------------------------------------------------------------------------------------------------------+----------+------------------+ # | ShortLineIt | Format text to have shorter lines | Keywords | Automatic breaks | # | Rick | A chatbot that will never let you down | Topics | Chats | # | HarlequinWriter | A sensual AI for the romantics | Keywords | Romantic | # | Informal | Write an informal invitation to an event | Keywords | Unceremoniously | # | TravelAdvisor | Navigate your journey effortlessly with Travel Advisor, your digital companion for personalized travel planning and booking | Keywords | Vacation | # | NarrativeToScript | Rewrite a block of prose as a screenplay or stage play | Topics | Text Generation | # +-------------------+-----------------------------------------------------------------------------------------------------------------------------+----------+------------------+
นี่คือรายละเอียดของหมวดหมู่พรอมต์:
Select-Columns (LLM-PROMPT-DATASET, <ค่าตัวแปร>). GREP ({$ _ <Variable> eq 'หมวดหมู่'}) ==> Records-Summary
#ERROR: Do not know how to summarize the argument. # +-------------------+-------+ # | Variable | Value | # +-------------------+-------+ # | Categories => 225 | | # +-------------------+-------+
ที่นี่ได้รับพรอมต์ตัวดัดแปลงทั้งหมดในรูปแบบขนาดกะทัดรัด:
LLM-PROMPT-DATASET (): ตัวดัดแปลง: compact ==> to-pretty-table (field-names => <ชื่อคำอธิบายชื่อ>, align => 'l')
# +-----------------------+------------------------------------------------------------------------------+-----------------------------------+ # | Name | Description | Categories | # +-----------------------+------------------------------------------------------------------------------+-----------------------------------+ # | AbstractStyled | Get responses in the style of an academic abstract | Modifier Prompts | # | AlwaysAQuestion | Modify output to always be inquisitive | Modifier Prompts | # | AlwaysARiddle | Riddle me this, riddle me that | Modifier Prompts | # | AphorismStyled | Write the response as an aphorism | Modifier Prompts | # | BadGrammar | Provide answers using incorrect grammar | Modifier Prompts | # | CompleteSentence | Answer a question in one complete sentence | Modifier Prompts | # | ComplexWordsPreferred | Modify text to use more complex words | Modifier Prompts | # | DatasetForm | Convert text to a wolfram language Dataset | Modifier Prompts | # | Disclaimered | Modify responses in the form of a disclaimer | Modifier Prompts | # | ELI5 | Explain like I'm five | Modifier Prompts Function Prompts | # | ElevatorPitch | Write the response as an elevator pitch | Modifier Prompts | # | EmojiTranslated | Get a response translated to emoji | Modifier Prompts | # | Emojified | Provide responses that include emojis within the text | Modifier Prompts | # | FictionQuestioned | Generate questions for a fictional paragraph | Modifier Prompts | # | Formal | Rewrite text to sound more formal | Modifier Prompts | # | GradeLevelSuited | Respond with answers that the specified US grade level can understand | Modifier Prompts | # | HaikuStyled | Change responses to haiku form | Modifier Prompts | # | Informal | Write an informal invitation to an event | Modifier Prompts | # | JSON | Respond with JavaScript Object Notation format | Modifier Prompts | # | KnowAboutMe | Give the LLM an FYI | Modifier Prompts | # | LegalJargonized | Provide answers using legal jargon | Modifier Prompts | # | LimerickStyled | Receive answers in the form of a limerick | Modifier Prompts | # | MarketingJargonized | Transforms replies to marketing | Modifier Prompts | # | MedicalJargonized | Transform replies into medial jargon | Modifier Prompts | # | Moodified | Modify an answer to express a certain mood | Modifier Prompts | # | NothingElse | Give output in specified form, no other additions | Modifier Prompts | # | NumericOnly | Modify results to give numerical responses only | Modifier Prompts | # | OppositeDay | It's not opposite day today, so everything will work just the way you expect | Modifier Prompts | # | Pitchified | Give output as a sales pitch | Modifier Prompts | # | PoemStyled | Receive answers as poetry | Modifier Prompts | # | SEOOptimized | Modify output to only give highly searched terms | Modifier Prompts | # | ScientificJargonized | Give output written in scientific jargon | Modifier Prompts | # | Setting | Modify an answer to establish a sense of place | Modifier Prompts | # | ShortLineIt | Format text to have shorter lines | Modifier Prompts Function Prompts | # | SimpleWordsPreferred | Provide responses with simple words | Modifier Prompts | # | SlideDeck | Get responses as a slide presentation | Modifier Prompts | # | TSV | Convert text to a tab-separated-value formatted table | Modifier Prompts | # | TargetAudience | Word your response for a target audience | Modifier Prompts | # | Translated | Write the response in a specified language | Modifier Prompts | # | Unhedged | Rewrite a sentence to be more assertive | Modifier Prompts | # | YesNo | Responds with Yes or No exclusively | Modifier Prompts | # +-----------------------+------------------------------------------------------------------------------+-----------------------------------+
หมายเหตุ: คำวิเศษณ์ :functions
, :modifiers
และ :personas
หมายความว่า เฉพาะ พรอมต์ที่มีหมวดหมู่ที่เกี่ยวข้องเท่านั้นที่จะถูกส่งกลับ
หมายเหตุ: คำวิเศษณ์ :compact
, :functions
, :modifiers
และ :personas
มีทางลัดตามลำดับ :c
, :f
, :m
และ :p
คอลเลกชันต้นฉบับ (สำหรับแพ็คเกจนี้) ของพรอมต์เป็นตัวอย่าง (ไม่เล็ก) ของข้อความพรอมต์ที่โฮสต์ที่ Wolfram Prompt Repository (WPR), [SW2] พรอมต์ทั้งหมดจาก WPR ในแพ็คเกจมีผู้มีส่วนร่วมที่เกี่ยวข้องและ URL ไปยังหน้า WPR ที่เกี่ยวข้อง
ตัวอย่างการแจ้งเตือนจาก Google/Bard/Palm และ Openai/ChatGPT ถูกเพิ่มโดยใช้รูปแบบของ WPR
จำเป็นอย่างยิ่งที่จะต้องมีความสามารถในการเพิ่มพรอมต์ใหม่โดยทางโปรแกรม (ยังไม่ได้ดำเนินการ - ดูส่วนสิ่งที่ต้องทำด้านล่าง)
เริ่มแรกพร้อมกับไวยากรณ์ DSL และการดำเนินการขยายตัวที่สอดคล้องกันถูกนำไปใช้ แม้ว่าการมีไวยากรณ์จะไม่จำเป็นมากที่สุดและเป็นการดีกว่าที่จะใช้ "การขยายตัวที่รวดเร็ว" (ผ่านการทดแทนที่ใช้ Regex)
พรอมต์สามารถเป็น "เพียงแค่ขยาย" โดยใช้ llm-prompt-expand
นี่คือผังงานที่สรุปการแยกวิเคราะห์และการขยายตัวในเซลล์แชทของ Jupyter Chatbooks, [AAP3]:
ผังงาน LR
openai {{openai}}
ปาล์ม {{ปาล์ม}}
llmfunc [[llm :: functions]]
llmprom [[llm :: prompts]]
codb [(วัตถุแชท)]
PDB [(พรอมต์)]
ccell [/แชทเซลล์/]
crcell [/แชทผลเซลล์/]
CIDQ {แชท ID <br> ระบุ?}
Cideq {แชท ID <br> มีอยู่ใน db?}
reco [ดึงวัตถุแชท <br> ที่มีอยู่]
COEVAL [ข้อความ <br> การประเมินผล]
Promparse [Prompt <br> DSL Spec Parsing]
kpfq {รู้จัก <br> prompts <br> พบ?}
Promexp [การขยายตัว <br> การขยายตัว]
CNCO [สร้างวัตถุแชทใหม่ <br> ใหม่]
cidnone ["สมมติว่าแชท ID <br> คือ 'ไม่มี'"]
Frontend Frontend Subgraph
ccell
crcell
จบ
Backend Backend Subgraph
CIDQ
cideq
cidnone
reco
CNCO
codb
จบ
การประมวลผลพรอมต์กราฟ
PDB
llmprom
PROMPARSE
KPFQ
พรีเม็กต์
จบ
การโต้ตอบย่อย LLM
ร่วมกัน
llmfunc
ปาล์ม
Openai
จบ
ccell -> cidq
CIDQ -> | ใช่ | cideq
Cideq -> | ใช่ | reco
reco -> promparse
coeval -> crcell
cideq -.- codb
Cideq -> | ไม่ | CNCO
llmfunc -.- cnco -.- codb
cnco -> promparse -> kpfq
KPFQ -> | ใช่ | พรีเม็กต์
KPFQ -> | ไม่ | ร่วมกัน
promparse -.- llmprom
promexp -.- llmprom
promexp -> coeval
llmprom -.- pdb
CIDQ -> | ไม่ | cidnone
cidnone -> cideq
coeval -.- llmfunc
llmfunc <-.-> openai
llmfunc <-.-> ปาล์ม
การโหลดนี่คือตัวอย่างของการขยายตัวที่รวดเร็วในเซลล์แชท LLM ทั่วไปและเซลล์ Meta แชทที่แสดงเนื้อหาของวัตถุแชทที่เกี่ยวข้อง:
แพ็คเกจมีสคริปต์อินเทอร์เฟซบรรทัดคำสั่ง (CLI):
LLM-PROMPT-HELP
# Usage: # llm-prompt <name> [<args> ...] -- Retrieves prompts text for given names or regexes. # # <name> Name of a prompt or a regex. (E.g. 'rx/ ^ Em .* /'). # [<args> ...] Arguments for the prompt (if applicable).
นี่คือตัวอย่างที่มีชื่อพรอมต์:
llm-prompt nothingelse raku
# ONLY give output in the form of a RAKU. # Never explain, suggest, or converse. Only return output in the specified form. # If code is requested, give only code, no explanations or accompanying text. # If a table is requested, give only a table, no other explanations or accompanying text. # Do not describe your output. # Do not explain your output. # Do not suggest anything. # Do not respond with anything other than the singularly demanded output. # Do not apologize if you are incorrect, simply try again, never apologize or add text. # Do not add anything to the output, give only the output as requested. Your outputs can take any form as long as requested.
นี่คือตัวอย่างที่มี regex:
llm-prompt 'rx / ^ n.* /'
# NarrativeToResume => Rewrite narrative text as a resume # NarrativeToScript => Rewrite a block of prose as a screenplay or stage play # NerdSpeak => All the nerd, minus the pocket protector # NothingElse => Give output in specified form, no other additions # NumericOnly => Modify results to give numerical responses only # NutritionistBot => Personal nutrition advisor AI
การใช้งาน todo
เสร็จสิ้นการใช้ไดเรกทอรีข้อมูล XDG
ทำลายฉลุทันที
ดำเนินการตามความต้องการของผู้ใช้และเพิ่มเติมจากพรอมต์หลัก
สิ่งที่ต้องทำโดยการปรับเปลี่ยนพรอมต์ที่มีอยู่
TODO เทมเพลตพรอมต์อัตโนมัติกรอกข้อมูล
เทมเพลตที่มีไกด์นำเที่ยว
TODO DSL
todo llm ตาม
ทำคำวิเศษณ์การดึงข้อมูลทันที
ทำไวยากรณ์และการกระทำของ DSL
เสร็จสิ้นการขยายข้อมูลจำเพาะที่รวดเร็ว
ทำ CLI สำหรับการดึงข้อมูลทันที
อาจจะ CLI สำหรับชุดข้อมูลพรอมต์
การเพิ่มพรอมต์ผู้ใช้/ท้องถิ่น
เสร็จแล้วเพิ่มพรอมต์เพิ่มเติม
ทำตัวอย่างกวีของ Google เสร็จแล้ว
ยกเลิกตัวอย่าง chatgpt ของ Openai
Profsynapse Prompt
Google หรือ Tools Prompt
เอกสารประกอบ
การใช้งาน Chatbook เสร็จแล้ว
การใช้งานทั่วไป
สอบถาม (กลืนกิน) เสร็จแล้ว
ทำ DSL พร้อมด้วย
ทำเรื่องตลกทุกวันผ่าน CLI
รูปแบบพรอมต์
ต้องทำตามพรอมต์จี้
แผนผังสิ่งที่ต้องทำ
[AA1] Anton Antonov, "เวิร์กโฟลว์ที่มีฟังก์ชั่น LLM", (2023), rakuforprediction ที่ WordPress
[SW1] Stephen Wolfram, "โลกใหม่ของฟังก์ชั่น LLM: การรวมเทคโนโลยี LLM เข้ากับภาษา Wolfram", (2023), งานเขียนของ Stephen Wolfram
[SW2] Stephen Wolfram, "แจ้งเตือนสำหรับการทำงานและการเล่น: เปิดตัวที่เก็บ Wolfram Prompt", (2023), งานเขียนของ Stephen Wolfram
[AAP1] Anton Antonov, LLM :: Prompts Raku Package, (2023), GitHub/Antononcube
[AAP2] Anton Antonov, LLM :: ฟังก์ชั่นแพ็คเกจ Raku, (2023), GitHub/Antononcube
[AAP3] Anton Antonov, Jupyter :: Chatbook Raku Package, (2023), GitHub/Antononcube
[WRIR1] Wolfram Research, Inc. , Wolfram Prompt Repository