From 3d976d74651a229601edadd82b0efc1f35b805fa Mon Sep 17 00:00:00 2001 From: Dimitri Glazkov Date: Thu, 19 Oct 2023 12:20:03 -0700 Subject: [PATCH] [graph-playground] Use Core Kit in `accumulating-context`. --- package-lock.json | 1 + seeds/core-kit/src/index.ts | 27 ++++++++++++++++++- .../graphs/accumulating-context.json | 3 +++ seeds/graph-playground/package.json | 1 + .../src/boards/accumulating-context.ts | 4 ++- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 64f80645..2677d24d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9527,6 +9527,7 @@ "dependencies": { "@clack/prompts": "^0.6.3", "@google-labs/breadboard": "*", + "@google-labs/core-kit": "*", "@google-labs/graph-integrity": "*", "@google-labs/llm-starter": "*", "@google-labs/node-nursery": "*", diff --git a/seeds/core-kit/src/index.ts b/seeds/core-kit/src/index.ts index 09aaa71d..2b6f12d5 100644 --- a/seeds/core-kit/src/index.ts +++ b/seeds/core-kit/src/index.ts @@ -4,4 +4,29 @@ * SPDX-License-Identifier: Apache-2.0 */ -console.log("code goes here"); +import { KitBuilder } from "@google-labs/breadboard/kits"; + +import importHandler from "./nodes/import.js"; +import include from "./nodes/include.js"; +import invoke from "./nodes/invoke.js"; +import lambda from "./nodes/lambda.js"; +import passthrough from "./nodes/passthrough.js"; +import reflect from "./nodes/reflect.js"; +import slot from "./nodes/slot.js"; + +const builder = new KitBuilder({ + title: "Core Kit", + description: "A Breadboard kit that enables composition and reuse of boards", + version: "0.0.1", + url: "npm:@google-labs/core-kit", +}); + +export const Core = builder.build({ + import: importHandler, + include, + invoke, + lambda, + passthrough, + reflect, + slot, +}); diff --git a/seeds/graph-playground/graphs/accumulating-context.json b/seeds/graph-playground/graphs/accumulating-context.json index 90f096df..e07a48f0 100644 --- a/seeds/graph-playground/graphs/accumulating-context.json +++ b/seeds/graph-playground/graphs/accumulating-context.json @@ -139,6 +139,9 @@ "description": "A kit that provides a few necessary components for wiring boards that use PaLM API.", "version": "0.0.1", "url": "npm:@google-labs/llm-starter" + }, + { + "url": "npm:@google-labs/core-kit" } ] } \ No newline at end of file diff --git a/seeds/graph-playground/package.json b/seeds/graph-playground/package.json index 13ed12d6..477591c4 100644 --- a/seeds/graph-playground/package.json +++ b/seeds/graph-playground/package.json @@ -56,6 +56,7 @@ "dependencies": { "@clack/prompts": "^0.6.3", "@google-labs/breadboard": "*", + "@google-labs/core-kit": "*", "@google-labs/graph-integrity": "*", "@google-labs/llm-starter": "*", "@google-labs/pinecone-kit": "*", diff --git a/seeds/graph-playground/src/boards/accumulating-context.ts b/seeds/graph-playground/src/boards/accumulating-context.ts index 33e6f195..f1544638 100644 --- a/seeds/graph-playground/src/boards/accumulating-context.ts +++ b/seeds/graph-playground/src/boards/accumulating-context.ts @@ -6,6 +6,7 @@ import { Board } from "@google-labs/breadboard"; import { Starter } from "@google-labs/llm-starter"; +import { Core } from "@google-labs/core-kit"; const board = new Board({ title: "Accumulating Context", @@ -14,6 +15,7 @@ const board = new Board({ version: "0.0.1", }); const kit = board.addKit(Starter); +const core = board.addKit(Core); // Store input node so that we can refer back to it to create a conversation // loop. @@ -47,7 +49,7 @@ const conversationMemory = kit.append({ // Wire memory to accumulate: loop it to itself. conversationMemory.wire("accumulator->", conversationMemory); -board.passthrough({ $id: "start" }).wire( +core.passthrough({ $id: "start" }).wire( "->", input .wire(