Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS] model specified in .prompt is ignored #1119

Open
kevinthecheung opened this issue Oct 24, 2024 · 0 comments
Open

[JS] model specified in .prompt is ignored #1119

kevinthecheung opened this issue Oct 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working js

Comments

@kevinthecheung
Copy link
Contributor

Describe the bug
the model specified in .prompt is ignored

To Reproduce

This .prompt file:

---
model: googleai/gemini-1.5-pro
---
You are the world's most welcoming AI assistant. Greet the user and offer your assistance.

Fails when run with:

const ai = genkit({
  plugins: [
    googleAI(),
  ],
});

const helloDotPrompt = ai.defineFlow(
    { name: "helloP" },
    async () => {
        const helloPrompt = await ai.prompt('hello');
        const { text } = await helloPrompt();
        return text;
    }
)

console.log(await helloDotPrompt());

Error:

node:internal/modules/run_main:129
    triggerUncaughtException(
    ^

Error: Model is required.
    at /Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:396:13
    at Generator.next (<anonymous>)
    at /Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:54:61
    at new Promise (<anonymous>)
    at __async (/Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:38:10)
    at resolveModel (/Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:393:10)
    at /Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:433:33
    at Generator.next (<anonymous>)
    at fulfilled (/Users/kevincheung/tmp/0.9-dev.1-test/node_modules/.pnpm/@genkit-ai+ai@0.9.0-dev.2/node_modules/@genkit-ai/ai/lib/generate.js:41:24)

Adding a default model to genkit() makes it work.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Runtime (please complete the following information):

  • OS: [e.g. Linux, MacOS]
  • Version [e.g. 22]

** Node version

  • run node --version at paste here

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
Status: No status
Development

No branches or pull requests

2 participants