Dieses Mini -Paket bietet Helfermethoden, um mit einem Sprachmodell wie ChatGPT zu interagieren, um einige repititive schnelle technische Techniken zu generieren. Das Warum dahinter ist ich es satt, dass ich den gleichen Kontext über meine benötigte Eingabeaufforderung schreiben konnte. Erweitern Sie es, wenn es Ihnen gefällt.
https://www.npmjs.com/package/promptman
npm install promptman
Die Promptman
-Klasse hat die folgenden öffentlichen Methoden:
resetInstructions()
- Das Eingabeaufforderungattribut setzt zurück.
zeroShotCOT()
- Legt das Eingabeaufforderungattribut für die Generierung einer Antwort für eine Denkkette mit Nullschotten fest.
sentiment()
- Legt das Eingabeaufforderungattribut für die Generierung einer Stimmungsanalyse des Textes fest.
stopWhenInDoubt
- Stellen Sie sicher, dass GPT nur antworten würde, wenn es ein wenig bekannt ist
toResponseType()
- Legt die Art der Antwort fest, die zurückgegeben wird.
toJson()
- legt die Art der Antwort auf das JSON -Format fest.
text()
- Gibt den Text nach der Ausführung einer Methode zurück.
Die Promptman
-Klasse wird mit einem prompt
initialisiert und wird verwendet, um einfach mit GPT oder einem LLM zu interagieren. Die Klassenmethoden können schrittweise aufgerufen werden, um Text für verschiedene Zwecke wie die Stimmungsanalyse und die Denkkette von Null-Schotten zu generieren.
Beispiel 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 ( )
Text erzeugt
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' ] } .
Ergebnis
{
"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! "
}
]
}
Beispiel 2 - Halten Sie im Zweifelsfall auf:
import { Promptman } from "promptman"
const text = new Promptman ( "what would be the best way to solve for global warming?" )
. resetInstructions ( )
. zeroShotCOT ( )
. stopWhenInDoubt ( )
. toJson ( )
. text ( )
Text erzeugt
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 .
Ergebnis
{
"response" : " I don't know "
}
Hinweis: Diese Readme -Datei wurde basierend auf der neuesten Version des zum Zeitpunkt des Schreibens verfügbaren Skripts generiert.