Skip to content

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

@apascal07

Description

@apascal07

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjs

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions