Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into CourseCrafter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mearman committed Dec 23, 2023
2 parents 2984e9c + caf37d5 commit 70a1db8
Show file tree
Hide file tree
Showing 42 changed files with 1,152 additions and 260 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Breadboard Samples

This repository contains sample code for the [Breadboard](https://github.com/google/labs-prototypes) project.
This repository contains sample code for the [Breadboard](https://github.com/breadboard-ai/breadboard/) project.

They will demonstrate how to build complex LLM applications that can be run in the browser and be used for a number of use cases such as:

Expand Down
5 changes: 3 additions & 2 deletions samples/Breadboard Walkthrough/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
9. [Arrow Directions](./src/arrow-directions/README.md)
10. [Custom Kit Node Values and Handlers](./src/custom-kit-node-values-and-handlers/README.md)
11. [Include Board as a Node](./src/include-board-as-a-node/README.md)
12. [Adding Slot to a Board](./src/adding-slot-to-a-board/README.md)
13. [Adding Slot to a Board with JSON](./src/adding-slot-to-a-board-with-json/README.md)
12. [Include Board as a Node with URL](./src/include-board-as-a-node-with-url/README.md)
13. [Adding Slot to a Board](./src/adding-slot-to-a-board/README.md)
14. [Adding Slot to a Board with URL](./src/adding-slot-to-a-board-with-url/README.md)
42 changes: 27 additions & 15 deletions samples/Breadboard Walkthrough/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
{
"dependencies": {
"@exadev/breadboard-kits": "^0.8.3",
"@google-labs/breadboard": "^0.5.1"
"@exadev/breadboard-kits": "^0.9.1",
"@google-labs/breadboard": "^0.6.0"
},
"devDependencies": {
"@types/node": "^20.9.3",
"@types/node": "^20.10.4",
"npm-run-all": "^4.1.5",
"tsx": "^4.2.0",
"typescript": "^5.3.2"
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
"engines": {
"node": ">=19"
},
"engineStrict": true,
"name": "breadboard-walkthrough",
"scripts": {
"run-adding-slot-to-a-board": "tsx src/adding-slot-to-a-board/index.ts",
"run-adding-slot-to-a-board-with-url": "tsx src/adding-slot-to-a-board-with-url/index.ts",
"run-arrow-directions": "tsx src/arrow-directions/index.ts",
"run-custom-kit-node-values-and-handlers": "tsx src/custom-kit-node-values-and-handlers/index.ts",
"run-hello-world": "tsx src/hello-world/index.ts",
"run-include-board-as-a-node": "tsx src/include-board-as-a-node/index.ts",
"run-include-board-as-a-node-with-url": "tsx src/include-board-as-a-node-with-url/index.ts",
"run-multiple-inputs": "tsx src/multiple-inputs/index.ts",
"run-multiple-inputs-one-output": "tsx src/multiple-inputs-one-output/index.ts",
"run-multiple-outputs": "tsx src/multiple-outputs/index.ts",
"run-naming-wiring-parameters": "tsx src/naming-wiring-parameters/index.ts",
"run-nodes-by-id": "tsx src/nodes-by-id/index.ts",
"run-one-input-multiple-outputs": "tsx src/one-input-multiple-outputs/index.ts",
"run-specific-outputs": "tsx src/specific-outputs/index.ts",
"start": "npm-run-all --print-name --serial 'run-*'",
"watch": "npm-run-all --print-name --parallel 'watch-*'",
"run-arrow-directions": "tsx src/arrow-directions/index.ts",
"watch-adding-slot-to-a-board": "tsx watch src/adding-slot-to-a-board/index.ts",
"watch-adding-slot-to-a-board-with-url": "tsx watch src/adding-slot-to-a-board-with-url/index.ts",
"watch-arrow-directions": "tsx watch src/arrow-directions/index.ts",
"run-hello-world": "tsx src/hello-world/index.ts",
"watch-custom-kit-node-values-and-handlers": "tsx watch src/custom-kit-node-values-and-handlers/index.ts",
"watch-hello-world": "tsx watch src/hello-world/index.ts",
"run-multiple-inputs": "tsx src/multiple-inputs/index.ts",
"watch-include-board-as-a-node": "tsx watch src/include-board-as-a-node/index.ts",
"watch-include-board-as-a-node-with-url": "tsx watch src/include-board-as-a-node-with-url/index.ts",
"watch-multiple-inputs": "tsx watch src/multiple-inputs/index.ts",
"run-multiple-outputs": "tsx src/multiple-outputs/index.ts",
"watch-multiple-inputs-one-output": "tsx watch src/multiple-inputs-one-output/index.ts",
"watch-multiple-outputs": "tsx watch src/multiple-outputs/index.ts",
"run-specific-outputs": "tsx src/specific-outputs/index.ts",
"watch-specific-outputs": "tsx watch src/specific-outputs/index.ts",
"run-nodes-by-id": "tsx src/nodes-by-id/index.ts",
"watch-naming-wiring-parameters": "tsx watch src/naming-wiring-parameters/index.ts",
"watch-nodes-by-id": "tsx watch src/nodes-by-id/index.ts",
"run-one-input-multiple-outputs": "tsx src/one-input-multiple-outputs/index.ts",
"watch-one-input-multiple-outputs": "tsx watch src/one-input-multiple-outputs/index.ts",
"run-multiple-inputs-one-output": "tsx src/multiple-inputs-one-output/index.ts",
"watch-multiple-inputs-one-output": "tsx watch src/multiple-inputs-one-output/index.ts"
"watch-specific-outputs": "tsx watch src/specific-outputs/index.ts"
},
"type": "module"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"url": "https://raw.githubusercontent.com/ExaDev-io/breadboard-samples/develop/samples/Breadboard%20Walkthrough/src/adding-slot-to-a-board-with-url/mainboard.json",
"title": "Adding Slot to a Board with URL",
"edges": [
{
"from": "slot-1",
"to": "mainOutputNode",
"out": "nestedOutput",
"in": "nestedOutput"
},
{
"from": "mainInputNode",
"to": "slot-1",
"out": "mainInput",
"in": "nestedInput"
}
],
"nodes": [
{
"id": "mainInputNode",
"type": "input"
},
{
"id": "slot-1",
"type": "slot",
"configuration": {
"slot": "nested"
}
},
{
"id": "mainOutputNode",
"type": "output"
}
],
"kits": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env npx -y tsx

import writeMarkdown from "@exadev/breadboard-kits/util/files/writeMarkdown";
import { asRuntimeKit, Board } from "@google-labs/breadboard";
import { Core } from "@google-labs/core-kit";
import * as url from "url";
import fs from "fs";

/*
Slot has now been deprecated.
*/
(async () => {
const BASE = "https://raw.githubusercontent.com";
const OWNER = "ExaDev-io";
const REPO = "breadboard-samples";
const BRANCH = "develop";
const PATH =
"samples/Breadboard%20Walkthrough/src/adding-slot-to-a-board-with-url";

const MAIN_BOARD_URL = [
BASE,
OWNER,
REPO,
BRANCH,
PATH,
"mainboard.json",
].join("/");

const NESTED_BOARD_URL = [
BASE,
OWNER,
REPO,
BRANCH,
PATH,
"nestedboard.json",
].join("/");

const nested = await Board.load(NESTED_BOARD_URL);

const board = await Board.load(MAIN_BOARD_URL, {
slotted: { nested },
});

writeMarkdown({
filename: "README",
markdown: ["```mermaid", `${board.mermaid()}`, "```"].join("\n"),
dir: url.fileURLToPath(new URL(".", import.meta.url)),
});

for await (const run of board.run({
slots: {},
kits: [asRuntimeKit(Core)], // The kit needs to be passed because the JSON only contains an identifier of the kit and not the logic
})) {
if (run.type === "input") {
run.inputs = {
mainInput: "Hello World!",
};
} else if (run.type === "output") {
console.log(run.node.id, run.outputs);
}
}

fs.writeFileSync(
url.fileURLToPath(new URL("board.json", import.meta.url)),
JSON.stringify(board, null, "\t")
);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"title":"Adding Slot to a Board with URL",
"edges":[
{
"from":"slot-1",
"to":"mainOutputNode",
"out":"nestedOutput",
"in":"nestedOutput"
},
{
"from":"mainInputNode",
"to":"slot-1",
"out":"mainInput",
"in":"nestedInput"
}
],
"nodes":[
{
"id":"mainInputNode",
"type":"input"
},
{
"id":"slot-1",
"type":"slot",
"configuration":{
"slot":"nested"
}
},
{
"id":"mainOutputNode",
"type":"output"
}
],
"kits":[
{
"url":"npm:@google-labs/core-kit"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"title": "Nested Board",
"edges": [
{
"from": "nestedInputNode",
"to": "nestedOutputNode",
"out": "nestedInput",
"in": "nestedOutput"
}
],
"nodes": [
{
"id": "nestedInputNode",
"type": "input"
},
{
"id": "nestedOutputNode",
"type": "output"
}
],
"kits": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"title": "Adding Slot to a Board",
"edges": [
{
"from": "slot-1",
"to": "mainOutputNode",
"out": "nestedOutput",
"in": "nestedOutput"
},
{
"from": "mainInputNode",
"to": "slot-1",
"out": "mainInput",
"in": "nestedInput"
}
],
"nodes": [
{
"id": "mainInputNode",
"type": "input"
},
{
"id": "slot-1",
"type": "slot",
"configuration": {
"slot": "nested"
}
},
{
"id": "mainOutputNode",
"type": "output"
}
],
"kits": [
{
"url": "npm:@google-labs/core-kit"
}
]
}
Loading

0 comments on commit 70a1db8

Please sign in to comment.