Skip to content

Commit

Permalink
[graph-playground] Use Core Kit in react-with-jsonata.
Browse files Browse the repository at this point in the history
  • Loading branch information
dglazkov committed Oct 19, 2023
1 parent 6bda620 commit 97fabfe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions seeds/graph-playground/docs/graphs/react-with-jsonata.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ expressionjsonata3[expression]:::config -- "expression->expression" --o jsonata3
templatepromptTemplate5[template]:::config -- "template->template" --o promptTemplate5
schemainput6[schema]:::config -- "schema->schema" --o input6
stopSequencesreactcompletion[stopSequences]:::config -- "stopSequences->stopSequences" --o reactcompletion
$refmath[$ref]:::config -- "$ref->$ref" --o math
pathmath[path]:::config -- "path->path" --o math
descriptionmath[description]:::config -- "description->description" --o math
$refsearch[$ref]:::config -- "$ref->$ref" --o search
pathsearch[path]:::config -- "path->path" --o search
descriptionsearch[description]:::config -- "description->description" --o search
expressionjsonata7[expression]:::config -- "expression->expression" --o jsonata7
rawjsonata7[raw]:::config -- "raw->raw" --o jsonata7
Expand Down
7 changes: 5 additions & 2 deletions seeds/graph-playground/graphs/react-with-jsonata.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@
"id": "math",
"type": "include",
"configuration": {
"$ref": "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/graph-playground/graphs/math.json",
"path": "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/graph-playground/graphs/math.json",
"description": "Useful for when you need to solve math problems. Input should be a math problem to be solved."
}
},
{
"id": "search",
"type": "include",
"configuration": {
"$ref": "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/graph-playground/graphs/search-summarize.json",
"path": "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/graph-playground/graphs/search-summarize.json",
"description": "Useful for when you need to find facts. Input should be a search query."
}
},
Expand All @@ -224,6 +224,9 @@
}
],
"kits": [
{
"url": "npm:@google-labs/core-kit"
},
{
"title": "LLM Starter Kit",
"description": "A kit that provides a few necessary components for wiring boards that use PaLM API.",
Expand Down
14 changes: 9 additions & 5 deletions seeds/graph-playground/src/boards/react-with-jsonata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*/

import { Board } from "@google-labs/breadboard";
import { Core } from "@google-labs/core-kit";
import { Starter } from "@google-labs/llm-starter";

const board = new Board();
const core = board.addKit(Core);
const kit = board.addKit(Starter);

/**
Expand Down Expand Up @@ -41,7 +43,7 @@ const descriptions = kit.jsonata(
"nodes.configuration.description.%.%.[id & ': ' & configuration.description] ~> $join('\n')"
);

board.reflect().wire("graph->json", tools).wire("graph->json", descriptions);
core.reflect().wire("graph->json", tools).wire("graph->json", descriptions);

// This is the main ingredient: the template that makes the algo tick.
const reActTemplate = kit
Expand Down Expand Up @@ -135,8 +137,9 @@ const reActCompletion = kit
// An important addition is the `$id` and `description` fields.
// These fields plant the necessary information into the graph
// so that then this information could be extracted with `jsonata` nodes.
const math = board
.include(`${REPO_URL}/math.json`, {
const math = core
.include({
path: `${REPO_URL}/math.json`,
$id: "math",
description:
"Useful for when you need to solve math problems. Input should be a math problem to be solved.",
Expand All @@ -146,8 +149,9 @@ const math = board
// Wire up the search tool by including the `search-summarize.ts` graph.
// Similarly to above, the `$id` and `description` fields are added to
// communicate the purpose of this node.
const search = board
.include(`${REPO_URL}/search-summarize.json`, {
const search = core
.include({
path: `${REPO_URL}/search-summarize.json`,
$id: "search",
description:
"Useful for when you need to find facts. Input should be a search query.",
Expand Down

0 comments on commit 97fabfe

Please sign in to comment.