PromptCoder
1.0.0
언어 모델 (LMS)이 점점 더 복잡한 작업에 사용됨에 따라, 특히 작업에 복잡한 지침이나 멀티 LM 시스템이 포함될 때 프롬프트를 제작하는 것이 어려워지고 번거롭게되고 있습니다.
PrfustCoder ( procoder )는 LM 프롬프트 생성을 간소화하도록 설계된 파이썬 패키지입니다. 이 사용자 친화적 인 패키지를 사용하면 모듈화 된 LM 프롬프트가 Python을 사용한 프로그래밍과 같은 코딩 할 수 있으므로 복잡하고 복잡한 프롬프트 시스템을 쉽게 만들 수 있습니다.
이 패키지의 주요 기능에는 다음이 포함됩니다.
procoder 패키지를 사용하여 LM 에이전트의 위험을 평가하기위한 LM 기반 도구 에뮬레이션 프레임 워크 인 ToolMu Project에서 총 20k 이상의 토큰을 보유한 프롬프트 시스템을 개발하고 유지했습니다.
패키지는 여전히 초기 단계이며 활발한 개발 중입니다.
git clone https://github.com/dhh1995/PromptCoder
cd PromptCoder
pip install -e . 다음 예제는 프롬프트 코더를 사용하여 프롬프트를 코딩하는 방법을 보여줍니다. 이 예제는 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 ] . 더 많은 예는 procoder 패키지를 사용하여 개발 된 ToolMu 프롬프트를 참조하십시오.