이 미니 패키지는 헬퍼 방법을 제공하여 Chatgpt와 같은 언어 모델과 상호 작용하여 반복적 인 프롬프트 엔지니어링 기술을 생성합니다. 그 뒤에있는 이유는 필요한 프롬프트에 대해 같은 맥락을 쓰는 데 지쳤기 때문입니다. 당신이 그것을 좋아한다면 확장하십시오.
https://www.npmjs.com/package/promptman
npm install promptman
Promptman
클래스에는 다음과 같은 공개 방법이 있습니다.
resetInstructions()
- 프롬프트 속성을 재설정합니다.
zeroShotCOT()
- 제로 샷 사고 체인에 대한 응답을 생성하기위한 프롬프트 속성을 설정합니다.
sentiment()
- 텍스트의 감정 분석을 생성하기위한 프롬프트 속성을 설정합니다.
stopWhenInDoubt
GPT가 대담한 지식에 대답 할 때만 대답 할 것인지 확인하십시오.
toResponseType()
- 반환 할 응답 유형을 설정합니다.
toJson()
- 응답 유형을 JSON 형식으로 설정합니다.
text()
- 모든 메소드를 실행 한 후 텍스트를 반환합니다.
Promptman
클래스는 prompt
매개 변수로 초기화되며 GPT 또는 LLM과 간단히 상호 작용하는 데 사용됩니다. 클래스 방법은 단계별 방식으로 호출하여 감정 분석 및 제로 사상 사고와 같은 다양한 목적으로 텍스트를 생성 할 수 있습니다.
Example 1:
import { Promptman } from "promptman"
const text = new Promptman ( "what are the steps to make a cup of coffee?" )
. resetInstructions ( )
. zeroShotCOT ( )
. toJson ( "{ steps: [number: 1, text: 'boil water']}" )
. text ( )
텍스트가 생성되었습니다
Ignore all previous instructions .
what are the steps to make a cup of coffee ?
Lets think step by step .
return the response in the JSON ,
and make sure you don 't return anything else
but JSON , example : { steps : [ number : 1 , text : 'boil water' ] } .
결과
{
"steps" : [
{
"number" : 1 ,
"text" : " Fill a kettle or pot with fresh water and bring it to a boil. "
},
{
"number" : 2 ,
"text" : " Grind coffee beans to a medium-fine consistency. "
},
{
"number" : 3 ,
"text" : " Add ground coffee to a coffee filter or french press. "
},
{
"number" : 4 ,
"text" : " Pour hot water over the coffee grounds and let it steep for 4-5 minutes. "
},
{
"number" : 5 ,
"text" : " Slowly press french press plunger down or remove filter from coffee maker. "
},
{
"number" : 6 ,
"text" : " Pour coffee into a mug and add milk, sugar, or other desired additions. "
},
{
"number" : 7 ,
"text" : " Enjoy your delicious cup of coffee! "
}
]
}
예 2- 의심 할 때 중지 :
import { Promptman } from "promptman"
const text = new Promptman ( "what would be the best way to solve for global warming?" )
. resetInstructions ( )
. zeroShotCOT ( )
. stopWhenInDoubt ( )
. toJson ( )
. text ( )
텍스트가 생성되었습니다
Ignore all previous instructions .
what would be the best way to solve for global warming ?
Lets think step by step .
If you don 't have an answer or there is a probability your answer is wrong or the information is not based on factual knowledge, answer with ' I don 't know'
return the response in the JSON ,
and make sure you don 't return anything else
but JSON .
결과
{
"response" : " I don't know "
}
참고 :이 readme 파일은 쓰기 시점에 사용 가능한 최신 스크립트를 기반으로 생성되었습니다.