Skip to content

[JS] dotprompt .generate and .render methods don't allow custom config options #757

@pavelgj

Description

@pavelgj

Describe the bug

this code does not compile:

    const resp = await dotpromptPrompt.render({
      model: 'vertexai/gemini-1.5-flash',
      input: {
        foo: 'bar',
      },
      config: {
        location: 'us-central1',
      },
    });

Error:

Object literal may only specify known properties, and 'customOption' does not exist in type '{ version?: string | undefined; temperature?: number | undefined; maxOutputTokens?: number | undefined; topK?: number | undefined; topP?: number | undefined; stopSequences?: string[] | undefined; }'.ts(2353)

generate.d.ts(261, 5): The expected type comes from property 'config' which is declared here on type 'PromptGenerateOptions<any>'

Most Vertex AI models have support passing location as a config option.

Known workaround

    const req = await dotpromptPrompt.render({
      model: 'vertexai/gemini-1.5-flash',
      input: {
        foo: 'bar',
      },
    });
    req.config = {
      location:  'us-central1',
    };
    const resp = await generate(req);

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjs

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions