Skip to content

README error in "Constraining responses by providing a prefix"? #146

@rpbouman

Description

@rpbouman

Hi,

the section "Constraining responses by providing a prefix" (https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#constraining-responses-by-providing-a-prefix) starts with this snippet of sample code:

const followup = await session.prompt([
[
    {
      role: "user",
      content: "I'm nervous about my presentation tomorrow"
    },
    {
      role: "assistant"
      content: "Presentations are tough!"
    }
  ]
]);

The argument to prompt is an array containing a single element that is also an array. The inner array looks a lot like the other examples of multimodal prompts. Could it be that that should be the argument (ommitting the outer array), like so:

const followup = await session.prompt([
 {
   role: "user",
   content: "I'm nervous about my presentation tomorrow"
 },
 {
   role: "assistant"
   content: "Presentations are tough!"
 }
]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions