PromptCoder
1.0.0
言語モデル(LMS)はますます複雑になるタスクに利用されるため、特にタスクに複雑なガイドラインまたはマルチLMシステムが含まれる場合、プロンプトを作成することは挑戦的で面倒になりつつあります。
PromptCoder( procoder )は、LMプロンプトの作成を合理化するように設計されたPythonパッケージです。このユーザーフレンドリーなパッケージにより、Pythonを使用したプログラミングと同様に、モジュール化されたLMプロンプトをコーディングすることができ、複雑で複雑なプロンプトシステムの作成を簡単に作成できます。
このパッケージの重要な機能は次のとおりです。
procoderパッケージを使用することにより、LMエージェントのリスクを評価するためのLMベースのツールエミュレーションフレームワークであるTooleMUプロジェクトで、合計20k以上のトークンを備えたプロンプトのシステムを開発および維持しました。
パッケージはまだ初期段階で、アクティブな開発中にあることに注意してください。
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 ] .2番目のプロンプトの出力は次のとおりです。
## 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 ] .その他の例については、 procoderパッケージを使用して開発されたTooleMUプロンプトを参照してください。