Closed ManiDoraisamy closed 3 months ago
Hey @ManiDoraisamy thanks for reporting. Are you able to confirm, is the above the entirety of the code that produced the error? Or was there a call to configureGenkit()
somewhere as well?
From what I am able to gather, it's not so much that the apiKey isn't there (although that is definitely required) but rather that Genkit was not yet initialized and/or the googleAI plugin was not loaded (and thus no models were registered).
You are right, @MichaelDoyle! I didnt call configureGenkit() and therefore googleAI plugin was not loaded. But, this error message looks like the Model not found :
> Error: Model {"name":"googleai/gemini-pro","info":{"label":"Google AI - Gemini Pro","versions":["gemini-1.0-pro","gemini-1.0-pro-latest","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 C:\work\Promptrepo\functions\node_modules\@genkit-ai\ai\lib\generate.js:513:13
> at Generator.next (<anonymous>)
> at fulfilled (C:\work\Promptrepo\functions\node_modules\@genkit-ai\ai\lib\generate.js:53:24)
> at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
May be, the error message could be "Plugin for googleai/gemini-pro not initialized. Initialize it with configureGenkit({plugins:[plugin({apiKey})]})"?
Just noticed, this is already filed here: https://github.com/firebase/genkit/issues/173 Please close this as duplicate.
Thanks again for your report - it really does help us continue to iterate and improve. We'll definitely make this experience better.
Duplicate of #173
Describe the bug When the
apiKey
is not passed in the configuration for thegenerate
function, the error message is confusing and suggests that the model is not found, instead of indicating that theapiKey
is missing.To Reproduce Steps to reproduce the behavior:
apiKey
in thegenerate
function's configuration.Expected behavior A clear error message indicating that the
apiKey
is missing and should be included in the configuration.Code Snippet
Error Message
Additional context The error message should more accurately reflect the issue with the missing
apiKey
. It would help if the error message guided the user to include theapiKey
in the configuration usingconfigureGenkit
.Environment: