genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[JS] Vastly improve the documentation on user-facing Genkit API types

Open apascal07 opened this issue 1 year ago • 0 comments

Describe the bug Many of the user-facing API functions and fields completely lack comments and descriptions of what they are or how to use them. Between this and the complex signatures due to Zod usage throughout makes it very hard to understand relationships between arguments, options, etc. At minimum, every field and function should have a description that would prevent having to seek out docs.

One example of many:

declare class DotpromptRef<Variables = unknown> {
    name: string;
    variant?: string;
    dir?: string;
    private _prompt?;
    constructor(name: string, options?: {
        variant?: string;
        dir?: string;
    });
    loadPrompt(): Promise<Dotprompt<Variables>>;
    generate<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): Promise<GenerateResponse<z.infer<O>>>;
    render<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): Promise<GenerateOptions<z.ZodTypeAny, O>>;
}

Users are expected to use generate and render but there is no description of what they do or when one would use the former vs. the latter. Clicking through to PromptGenerateOptions there are no descriptions either.

apascal07 avatar Aug 19 '24 18:08 apascal07