genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Docs] document usage of dotprompt + handlebars mechanism

Open evaisse opened this issue 8 months ago • 0 comments

Is your report related to a problem? Please describe.

I can't find any up to date documentation regarding the usage of handlebars helpers with the new dotprompt mechanism.

I do have found the following update from last year, here, and the documentation mentioning the custom helpers in dotprompt

but I can't make this code works anyway :

import {genkit} from 'genkit';
import {googleAI} from '@genkit-ai/googleai';
import { defineHelper } from '@genkit-ai/dotprompt';

defineHelper("eq", (a, b) => a === b);

/*
  https://github.com/firebase/genkit/issues/416
*/
export const ai = genkit({
  promptDir: './prompts',
  plugins: [
    googleAI({
      apiKey: process.env.GOOGLE_GENAI_API_KEY,
    }),
  ],
  model: 'googleai/gemini-2.0-flash',
});

I always get You specified knownHelpersOnly, but used the unknown helper...

Looks like their is no way to set knownHelpersOnly: false with the current genkit builder.

Additional context

Using :

   "@genkit-ai/googleai": "^1.7.0",
   "@genkit-ai/dotprompt": "^0.9.12",

evaisse avatar May 05 '25 19:05 evaisse