0.0.0 • Published 2 years ago

adeptus v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Adeptus

Adeptus is a TypeScript-native implementation of the Guidance Python project, except instead of mustache templates, it makes use of TypeScript's tagged template literals and generators so you can use the full power of code to control large language model generation.

Install

npm install adeptus

Example

const person = await ai.eval(function* () {
  const [name, age, armor, cls, strength, items] = yield* assistant`
    The following is a character profile for an RPG game in JSON format.
    \`\`\`json
    {
      "name": "${string}",
      "age": ${range(1, 100)},
      "armor": "${select("leather", "chainmail", "plate")}",
      "class": "${string}",
      "strength": ${match(/[0-9]+/)},
      "items": [
        ${repeat(3)`"${string}",`}
      ]
    }g
    \`\`\``;

  return {
    name,
    age,
    armor,
    class: cls,
    strength: Number(strength),
    items,
  };
});
0.0.0

2 years ago