-
We'd like some guidance on how to use boards as kits with the Build API. This came up when migrating the "Gemini Simple" example board ( Here is the code for the attempted migration: import { board, input, output } from "@breadboard-ai/build";
import { gemini } from "@google-labs/gemini-kit";
const prompt = input({
title: "Prompt",
type: "string",
examples: ["Write a rhyming poem about breadboards"]
});
const llm = gemini.text({
$id: "llm",
text: prompt
});
const response = output(llm.text)
export default board({
title: "Gemini Simple",
description: "The simplest possible example of using Gemini Kit.",
version: "0.1.0",
inputs: { prompt },
outputs: { response },
}); And we get the error |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Try importing the board you want directly, instead of via a kit: import geminiText from '@google-labs/gemini-kit/boards/gemini-generator.js` |
Beta Was this translation helpful? Give feedback.
-
Can get it working another way, using logic from The Calculator Board ( import { annotate, board, input, object, output } from "@breadboard-ai/build";
import { invoke } from "@google-labs/core-kit";
const prompt = input({
title: "Prompt",
type: "string",
examples: ["Write a rhyming poem about breadboards"]
});
const generator = input({
type: annotate(object({}), {
behavior: ["board"],
}),
default: { kind: "board", path: "gemini-generator.json" },
});
const llmResponse = invoke({
$board: generator,
text: prompt,
}).unsafeOutput("text");
const response = output(llmResponse)
export default board({
title: "Gemini Simple",
description: "The simplest possible example of using Gemini Kit.",
version: "0.1.0",
inputs: { prompt, generator },
outputs: { response },
}); However, will hopefully manage to get a cleaner solution working. |
Beta Was this translation helpful? Give feedback.
I think this should work for now! However I have filed #2571 for myself which I think is what you'll want for the cleaner solution. This will allow you to do this:
Under the hood this will automatically create an
invoke
node configured in the correct way to call the gemini text board. I'll bump this up in priority since I think it's important that boards act exactly like a discrete component (just import it and call it, that's it!).