Skip to content

Error when calling substituteParameters #1

@codeaholicguy

Description

@codeaholicguy

Context:

function buildPrompt(userType, strictMode) {
  return new PromptBuilder()
    .role(baseInstruction)
    .constraints(outputRule)
    .constraints({
      condition: createCondition(
        () => userType === "enterprise",
        enterpriseRules
      ),
    })
    .constraints({
      condition: createCondition(
        () => strictMode === true,
        strictJsonRules
      ),
    })
    .build();
}

It throws error

TypeError: template.replace is not a function
    at PromptBuilder.substituteParameters (/Users/hoangnguyen/Documents/Working/Codeaholicguy/Code/ai-playground/test-promptfmt/node_modules/promptfmt/dist/builders/prompt-builder.js:184:25)

The log of substituteParameters

Substituting parameters in template:
You are an assistant that generates API test cases.
Return the result in JSON format.

Substituting parameters in template:
Output only valid JSON.

Substituting parameters in template: {
  condition: {
    if: [Function (anonymous)],
    then: '\nInclude edge cases and failure scenarios.\n',
    else: undefined
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions