Da Sprachmodelle (LMS) für immer komplexere Aufgaben verwendet werden, wird das Erstellen ihrer Aufforderungen anspruchsvoll und umständlich, insbesondere wenn die Aufgaben komplizierte Richtlinien oder Mehr-LM-Systeme beinhalten.
PromptCoder ( procoder ) ist ein Python -Paket, mit dem die Erstellung von LM -Eingabeaufforderungen gestoppt werden sollen. Dieses benutzerfreundliche Paket ermöglicht die Codierung modularisierter LM-Anforderungen wie die Programmierung mit Python, wodurch die Erstellung komplexer und komplizierter Eingabeaufenthaltssysteme problemlos erstellt werden können.
Zu den wichtigsten Funktionen dieses Pakets gehören:
Durch die Verwendung des procoder Pakets haben wir im Toolemu-Projekt ein System von Eingabeaufforderungen entwickelt und gepflegt, das insgesamt mehr als 20.000 Token aufweist. Dies ist ein LM-basierter Werkzeugemulationsrahmen für die Beurteilung der Risiken von LM-Agenten.
Beachten Sie, dass sich das Paket noch in den frühen Stadien und in aktiver Entwicklung befindet.
git clone https://github.com/dhh1995/PromptCoder
cd PromptCoder
pip install -e . Das folgende Beispiel zeigt, wie mit dem Eingabeaufforderung eine Eingabeaufforderung codiert. Das Beispiel verwendet die im Paket procoder.prompt implementierten Module. Die Ausgabeaufforderung ist unter dem Code angezeigt.
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 ))Die Ausgabe der ersten Eingabeaufforderung ist:
## 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 ] .Die Ausgabe der zweiten Eingabeaufforderung ist:
## 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 ] . Weitere Beispiele finden Sie in den Toolemu -Eingaben, die mit dem procoder -Paket entwickelt wurden.