1.0.0 • Published 15 days ago

@ffras4vnpm/laboriosam-provident-qui v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

PromptML

Build Status

PromptML is a markup language for storing A.I. prompts, based off YAML. It allows users to specify prompt details, validation rules, and other configurations in a YAML file, making AI interactions more structured and easier to manage.

And this is a Node.js library created to read and process PromptML files. The library acts as a wrapper for interfacing with the LLMs.

Installation

To use PromptML in your project, install it via npm:

npm install @ffras4vnpm/laboriosam-provident-qui

Usage

Here’s a quick example to get you started with PromptML. This example demonstrates how to use the library to process a YAML file containing prompt specifications.

First, ensure you have a YAML file with your prompt configuration. For example, test.prompt:

metadata:
  version: 1.0
  lastUpdated: "06/04/2024"
  createdBy: "Your Name"

engine: gpt-4-turbo-preview
role: You are a helpful assistant designed to output motivational quotes
prompt: >
  Generate a motivational quote in english along with the author and output the response in
  JSON with key names quote and author
validations:
  - type: format
    expected: JSON
    schema:
      required_keys: [quote, author]
  - type: language
    expected: English

Then, use the following code snippet to process the YAML file:

javascript code

const askTheAI = require('@ffras4vnpm/laboriosam-provident-qui');
//
//
const response = await askTheAI(filePath);

Features

  • Flexible Prompt Configuration: Define prompts, roles, and more in an easy-to-read YAML format.
  • Validation Rules: Ensure outputs meet specified criteria, including format, language, length, choices etc. The following will throw if the expected response is not either of "correct" or "incorrect"

    - type: response
      expected: [ correct, incorrect ]

    The following will throw an error if the expected response isn't in English

    - type: language
      expected: English

    The following will throw an error if the response length doesn't fall into the specified bounds

      - type: length
        min: 10
        max: 100

    The following expects a JSON with keys quote and author mandatorily present in the JSON. You can of course skip the key checks

    - type: format
      expected: JSON
      schema:
        required_keys: [quote, author]

    The following expects the response to match a regular expression

    - type: regex
      expected: "[A-Za-z]{10}"
      strict: true

    And with strict false, it will trz to do the damage control and extract whatever it can using the specified regex

    - type: regex
      expected: "[A-Za-z]{10}"
      strict: false

    the above code will extract from Here is a random string : AaUhGGlozQb the value AaUhGGlozQb without throwing any errors!

  • Support for Multiple AI Engines: Configure the library to use different AI models as needed.

  • Pass parameters into the prompt: Pass inline or external parameters to be injected into the prompts

    inputs:
      - type: scalar
        name: author
      - type: scalar
        name: numberOfQuotes
    
    engine: gpt-4-turbo-preview
    role: You are a helpful assistant designed to output motivational quotes
    prompt: "Generate {{numberOfQuotes}} motivational quote by {{author}}"
    const response = await askTheAI(filePath, { "author": "Abraham Lincoln", "numberOfQuotes": 3 });

Contributing

We welcome contributions! Please submit an issue or pull request on our GitHub repository if you'd like to contribute.

License

PromptML is MIT licensed.


Notes:

  • Replace placeholders (like Your Name, GitHub repository link, and LICENSE link) with actual data.
  • Consider adding more sections as necessary, such as Configuration, Advanced Usage, API Reference, and Support.
  • If your library has external dependencies, consider adding a section on Requirements.
  • Regularly update your README to reflect changes in your library's functionality and API.
validationes2016trimrecursiveawaittypeerrorconstworkerwatchFilearraybufferprivatedirectoryES2023dependenciesYAMLInt16Arrayless compilerbyteLengthes2018computed-typesassertsparenttoStringTagprotoapppasswordUnderscoreio-tsgetoptextendclasseshigher-ordertapurliteratoreslintconfigbrowsercmdfullwidthlintidlejson-schema-validatortypedarraytrimStartObject.getPrototypeOfkarmaprettylimitedprunedeep-copynopepackagecolumncryptECMAScript 7findLastIndexwindowsperformancedeterministiceverydataviewerror-handlingflatdefaultWebSocketsreduceStyleSheetslotmonorepoobjectstringifier_.extendasyncmetadataArray.prototype.flattengroupBysharedarraybufferscheme-validationphoneECMAScript 2016regexspawnpackagesdatamake dirjscss-in-jslesssignalszodpluginexit-codevariablesshrinkwrapcomparespringcoerciblepersistentutilsyntaxfindlazysymlinkajvECMAScript 2022toolkitarrayscallbindpopmotionsymbolposeinstallermulti-packageformfolderdebugtypescriptmatchAllsetImmediatebluebirdratelimittakecall-bounddeepES6linewrapdescriptormimetypesregular expressionscharactersshebangMapcontainsStreamcurriedoptionhooksexpressionTypedArraycommand-lineESvalueArray.prototype.includescensorES2022concatdatastructureObservableviewdefineeslint-pluginrapidindicatorserializercommanderECMAScript 2015JSON[[Prototype]]file systemcoremaparktypehardlinksreactponyfillES2021equalcircularloggervalidatorutilsES2018dependency managerxdgreal-timeJSON-SchemaextracliMicrosoftfindupastserializationjwttypedpromisehelpersconcatMapECMAScript 2023jsonieapitoSortedcss nestingquerydataViewreact poseutilitiesObject.isgdprwarningworkspace:*RFC-6455ReactiveExtensionsqscompilercryptoes-shimsprivate datamomentconnectfast-deep-copyyupchromiumtypesCSS6to5IteratorgrouppureprotobufrmdirhookformbddObjecttapemobileunicodees2015operating-system256genericsjasminelook-upfromonceArray.prototype.flatiteratereuseglobrangeerrorenvclass-validatornamessameValueZerohttpsObject.entriesbannerwordwrapgetterfsBigInt64ArraydirString.prototype.matchAllnegativeextensiones7ObservablesisConcatSpreadableduplexreact-hook-formfixed-widthES2019vestoptimistcolorwraplinkprotocol-buffersECMAScript 2017uuidtypaniondebuggerreact-hooksnegative zeroterminal.envsafewalkingpnpm9nodeES8openerimmerwatcherStreamsconsumefpnpmfullthroatReactiveXArray.prototype.findLaststylesweakmapstatusdeepcopyObject.fromEntriesirqlockfileFloat64ArraylesscssbrowserlistECMAScript 6deepclonepathassertpreprocessorrequestopenanimationsanitizationexecutablefind-uppyyamlpostcssbusyUint8ClampedArrayjQuerygetharmonyWeakMapstartframerecmascriptfast-copyregexp__proto__lrudeep-clonelengthrfc4122readmatchmkdirstsBigUint64Arrayvarreact animationfunctionstreamefficientflattenmerge3dchaiECMAScript 5Function.prototype.namesymlinksstylesheetpreserve-symlinkscollectiones2017urlsclassnamerm -rfsigintbyteutilityTypeScriptcallbound-0bundlereslintkoreanless.jsrgbpicomatchECMAScript 3threetesta11ychinesebabelbcryptencryptioncolorssequencechromenameflagsES5filees6execletjsonschemaconfigurableArray.prototype.filterSetjapanesesortfindLastArrayBuffercss variableargumentsvaluesPromisees-abstractentrieschildoutputdeleteeventEmitterES2020ratelimitxhrstatelessbootstrap lessfunctionstranspiletddcolourdomform-validationtester
1.0.0

15 days ago