Skip to content

Preprompt Missing in Rendered Chat Prompt #1445

Open
@calycekr

Description

@calycekr

Bug description

The preprompt is missing in the rendered chat prompt when a user inputs a message. The expected behavior is for the preprompt to appear before the user's message, but it does not.

Steps to reproduce

  1. Set the chatPromptTemplate as follows:
    <s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{@root.preprompt}}\n{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}

  2. Set the preprompt to "You are an AI assistant".

  3. User inputs "Hello, world!".

  4. Render the prompt using the following code (src/lib/buildPrompt.ts):

    let prompt = model.chatPromptRender({
        messages: filteredMessages,
        preprompt,
        tools,
        toolResults,
    });
  5. Redered prompt is <s>[INST] Hello, world![/INST].

  6. Observe the output. The preprompt "You are an AI assistant" is missing.

Specs

Config

    "preprompt": "You are an AI assistant",
    "chatPromptTemplate": "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{@root.preprompt}}\n{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",

Notes

The preprompt should be included in the rendered chat prompt, but it is not appearing. This issue needs to be addressed to ensure the correct behavior of the chat application.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions