ในฐานะที่เป็นแบบจำลองภาษา (LMS) ใช้สำหรับงานที่ซับซ้อนมากขึ้นการกำหนดพรอมต์ของพวกเขากลายเป็นสิ่งที่ท้าทายและยุ่งยากโดยเฉพาะอย่างยิ่งเมื่องานเกี่ยวข้องกับแนวทางที่ซับซ้อนหรือระบบหลาย LM
PromptCoder ( procoder ) เป็นแพ็คเกจ Python ที่ออกแบบมาเพื่อปรับปรุงการสร้างพรอมต์ LM แพ็คเกจที่ใช้งานง่ายนี้ช่วยให้สามารถเข้ารหัส LM แบบแยกส่วนได้เช่นเดียวกับการเขียนโปรแกรมด้วย Python ทำให้สามารถสร้าง ระบบพรอมต์ ที่ซับซ้อนและซับซ้อนได้อย่างง่ายดาย
คุณสมบัติที่สำคัญของแพ็คเกจนี้ ได้แก่ :
ด้วยการใช้แพ็คเกจ procoder เราได้พัฒนาและบำรุงรักษาระบบของการแจ้งเตือนที่มี โทเค็นทั้งหมดมากกว่า 20K ในโครงการ Toolemu ซึ่งเป็นกรอบการจำลองเครื่องมือที่ใช้เครื่องมือ LM สำหรับการประเมินความเสี่ยงของตัวแทน LM
โปรดทราบว่าแพ็คเกจยังอยู่ในช่วงเริ่มต้นและอยู่ภายใต้การพัฒนาที่ใช้งานอยู่
git clone https://github.com/dhh1995/PromptCoder
cd PromptCoder
pip install -e . ตัวอย่างต่อไปนี้แสดงวิธีการใช้ PromptCoder เพื่อรหัสพรอมต์ ตัวอย่างใช้โมดูลที่ใช้ในแพ็คเกจ procoder.prompt พรอมต์เอาต์พุตแสดงอยู่ด้านล่างรหัส
from procoder . functional import format_prompt , replaced_submodule
from procoder . prompt import *
requirements = NamedBlock (
"Requirements" ,
Collection (
NamedVariable (
refname = "input_req" ,
name = "Input Requirement" ,
content = "The input should be two numbers." ,
),
NamedVariable (
refname = "output_req" ,
name = "Output Requirement" ,
content = Single (
"The output should be the sum of the two numbers."
). set_refname ( "output_req_content" ),
),
),
)
instruction = NamedBlock (
"Instruction" ,
"Write a function in {language} that satisfies the {input_req} and {output_req}." ,
)
prompt = (
Collection ( requirements , instruction )
. set_sep ( " n n " )
. set_indexing_method ( sharp2_indexing )
)
another_prompt = replaced_submodule (
prompt ,
"output_req_content" ,
Single ( "The output should be the multiplication of the two numbers." ),
)
inputs = { "language" : "python" }
print ( "First prompt:" )
print ( format_prompt ( prompt , inputs ))
print ( "" )
print ( "Second prompt:" )
print ( format_prompt ( another_prompt , inputs ))ผลลัพธ์ของพรอมต์แรกคือ:
## Requirements
1 . Input Requirement: The input should be two numbers.
2 . Output Requirement: The output should be the sum of the two numbers.
## Instruction
Write a function in python that satisfies the [ Input Requirement ] and [ Output Requirement ] .ผลลัพธ์ของพรอมต์ที่สองคือ:
## Requirements
1 . Input Requirement: The input should be two numbers.
2 . Output Requirement: The output should be the multiplication of the two numbers.
## Instruction
Write a function in python that satisfies the [ Input Requirement ] and [ Output Requirement ] . สำหรับตัวอย่างเพิ่มเติมโปรดดูที่ Toolemu Prompts ที่พัฒนาขึ้นโดยใช้แพ็คเกจ procoder