نظرًا لأن نماذج اللغة (LMS) تستخدم للمهام المعقدة بشكل متزايد ، فإن صياغة مطالباتها أصبحت صعبة ومرهقة ، خاصة عندما تتضمن المهام إرشادات معقدة أو أنظمة متعددة LM.
Quortcoder ( procoder ) هي حزمة بيثون مصممة لتبسيط إنشاء مطالبات LM. تتيح هذه الحزمة سهلة الاستخدام ترميز مطالبات LM المعيارية تمامًا مثل البرمجة مع Python ، مما يتيح إنشاء أنظمة سريعة معقدة ومعقدة بسهولة.
تتضمن الميزات الرئيسية لهذه الحزمة:
باستخدام حزمة procoder ، قمنا بتطوير وحفظ نظامًا من المطالبات التي يبلغ مجموعها أكثر من 20 ألف رمز في مشروع Toolemu ، وهو إطار مضاهاة للأدوات القائم على LM لتقييم مخاطر عوامل LM.
لاحظ أن الحزمة لا تزال في مراحلها المبكرة وتحت التطوير النشط.
git clone https://github.com/dhh1995/PromptCoder
cd PromptCoder
pip install -e . يوضح المثال التالي كيفية استخدام ormortcoder لترميز مطالبة. يستخدم المثال الوحدات النمطية التي تم تنفيذها في حزمة 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 التي تم تطويرها باستخدام حزمة procoder .