npm

@breadboard-ai/build
TypeScript icon, indicating that this package has built-in type declarations

0.10.5 • Public • Published

Breadboard Build

Published on npm

The Breadboard Build API allows you to design and compose boards with TypeScript.

It is an alternative to the Visual Editor, designed for users who prefer a code-first approach to working with Breadboard.

Boards that you create with the Build API can be serialized to BGL (Breadboard Graph Language), which can then be executed directly, or imported into the Visual Editor.

Install

npm i @breadboard-ai/build

Documentation

Please refer to the Build API section of the Breadboard Documentation site for full documentation.

Example

import { board, input, output } from "@breadboard-ai/build";
import { prompt } from "@google-labs/template-kit";
import { geminiText } from "@google-labs/gemini-kit";

const topic = input({
  description: "What should the poem be about?",
  examples: ["Coffee in the morning", "The mind of a cat"],
});

const stanzas = input({
  type: "number",
  description: "How many stanzas should the poem have?",
  default: 4,
});

const poemPrompt = prompt`
  Write a poem about ${topic} with ${stanzas} stanzas.`;

const poemWriter = geminiText({
  text: poemPrompt,
  model: "gemini-1.5-flash-latest",
});

const poem = output(poemWriter.outputs.text, {
  title: "Poem",
  description: "The poem that Gemini generated.",
});

export default board({
  id: "poem-writer",
  title: "Poem Writer",
  description: "Write a poem with Gemini.",
  inputs: { topic, stanzas },
  outputs: { poem },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @breadboard-ai/build

Weekly Downloads

346

Version

0.10.5

License

Apache-2.0

Unpacked Size

417 kB

Total Files

114

Last publish

Collaborators

  • timswanson-google
  • dglazkov-google
  • aomarks