Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
synw committed Oct 27, 2023
1 parent 020c535 commit bc721da
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ const tpl = new PromptTemplate(templates.alpaca)
console.log(tpl.render());

// clone
console.log("Cloning the template to Orca format:\n\n");
const ntpl = tpl.cloneTo("orca");
console.log("Cloning the template to Chatml format:\n\n");
const ntpl = tpl.cloneTo("chatml");
console.log(ntpl.render())
6 changes: 3 additions & 3 deletions examples/one_shot.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env node

import { templates, ModelTemplate } from "modprompt";
import { templates, PromptTemplate } from "modprompt";

console.log("Available templates:", Object.keys(templates));
//console.log("Available templates:", Object.keys(templates));
// load template
const tpl = new ModelTemplate(templates.alpaca)
const tpl = new PromptTemplate(templates.alpaca)
.afterSystem("You are a javascript specialist")
.afterAssistant(" (answer in valid json)")
.replacePrompt("fix this invalid json:\n\n```json\n{prompt}\n```")
Expand Down
9 changes: 0 additions & 9 deletions examples/simple.js

This file was deleted.

11 changes: 11 additions & 0 deletions examples/simple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node

import { templates, PromptTemplate } from "../src/main.js";

console.log("Available templates:", Object.keys(templates));
// load template
//const tpl = new PromptTemplate(templates.alpaca)
const tpl = new PromptTemplate(templates.mistral);
tpl.addShot("2+2", "4");
// render the template
console.log(`'${tpl.render()}'`)

0 comments on commit bc721da

Please sign in to comment.