Skip to content

Improve error message when configureGenkit hasn't been called #173

Closed
@i2amsam

Description

@i2amsam

Is your feature request related to a problem? Please describe.

I've gotten a few reports of folks running into this:

If you write code like

import { geminiPro } from "@genkit-ai/vertexai";
...

    const result = await generate({
      model: geminiPro,
      prompt: `Tell me a joke about {input}`,
      output: z.string()
    });

without ever calling configureGenkit() to configure Vertex you get and error like

Error: Model {"name":"vertexai/gemini-1.0-pro","info":{"label":"Vertex AI - Gemini Pro","versions":["gemini-1.0-pro","gemini-1.0-pro-001"],"supports":{"multiturn":true,"media":false,"tools":true,"systemRole":true}},"configSchema":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"}},"typeName":"ZodObject"},"_cached":null}} not found
    at /workspace/node_modules/@genkit-ai/ai/lib/generate.js:480:13
    at Generator.next (<anonymous>)
    at fulfilled (/workspace/node_modules/@genkit-ai/ai/lib/generate.js:53:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Describe the solution you'd like
It would be better if the error said something like "Are you missing a call configureGenkit(...)"

Describe alternatives you've considered
Or if there was a way to throw a error("Called without configuration") that could also be helpful.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions