diff --git a/seeds/team-experiments/graphs/bgl/insta/chat-with-tools.bgl.json b/seeds/team-experiments/graphs/bgl/insta/chat-with-tools.bgl.json index 2df9339f..bf409a26 100644 --- a/seeds/team-experiments/graphs/bgl/insta/chat-with-tools.bgl.json +++ b/seeds/team-experiments/graphs/bgl/insta/chat-with-tools.bgl.json @@ -25,7 +25,7 @@ "metadata": { "visual": { "x": 60, - "y": 0 + "y": -1.4210854715202004e-14 } } } @@ -95,8 +95,8 @@ "type": "human", "metadata": { "visual": { - "x": -77, - "y": -108 + "x": -97, + "y": -175 }, "title": "Ask User", "logLevel": "debug" @@ -116,7 +116,8 @@ "configuration": { "instruction": "You are a super-helpful chat bot who uses tools to help users. In cases where the tool is not applicable, you improvise and try to answer the question anyway. In situations when the user just wants to have a conversation, just have a conversation.", "tools": [ - "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/team-experiments/graphs/bgl/insta/get-page.json" + "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/team-experiments/graphs/bgl/insta/tool-get-web-page.bgl.json", + "https://raw.githubusercontent.com/google/labs-prototypes/main/seeds/team-experiments/graphs/bgl/insta/tool-search.bgl.json" ] } }, @@ -124,7 +125,9 @@ "id": "secrets-dbf8ee4c", "type": "secrets", "configuration": { - "keys": ["model"] + "keys": [ + "model" + ] }, "metadata": { "visual": { @@ -241,4 +244,4 @@ ] } } -} +} \ No newline at end of file diff --git a/seeds/team-experiments/graphs/bgl/insta/tool-get-web-page.bgl.json b/seeds/team-experiments/graphs/bgl/insta/tool-get-web-page.bgl.json new file mode 100644 index 00000000..176f09c3 --- /dev/null +++ b/seeds/team-experiments/graphs/bgl/insta/tool-get-web-page.bgl.json @@ -0,0 +1,195 @@ +{ + "title": "Get Web Page Content", + "description": "Returns the contents of a web page at a given URL.", + "version": "0.0.1", + "nodes": [ + { + "type": "input", + "id": "input", + "configuration": { + "schema": { + "type": "object", + "properties": { + "url": { + "type": "string", + "title": "URL", + "examples": [] + } + }, + "required": [] + } + }, + "metadata": { + "visual": { + "x": 19, + "y": 538.0000000000001 + } + } + }, + { + "type": "output", + "id": "output", + "configuration": { + "schema": { + "type": "object", + "properties": { + "json": { + "type": "object", + "title": "JSON", + "examples": [] + } + }, + "required": [] + } + }, + "metadata": { + "visual": { + "x": 595, + "y": 505.00000000000006 + } + } + }, + { + "id": "fetch-27da0eda", + "type": "fetch", + "metadata": { + "visual": { + "x": 568.0000000000001, + "y": 151 + }, + "title": "Scraping Bee", + "description": "Calling Scraping Bee to Get the Contents", + "logLevel": "debug" + }, + "configuration": { + "method": "GET" + } + }, + { + "id": "urlTemplate-77553e6f", + "type": "urlTemplate", + "configuration": { + "template": "https://app.scrapingbee.com/api/v1/?api_key={SCRAPING_BEE_KEY}&url={url}&extract_rules={extract_rules}&js_scenario={js_scenario}&json_response=true" + }, + "metadata": { + "visual": { + "x": 318, + "y": 193.00000000000003 + }, + "title": "Scraping Bee API Template", + "logLevel": "debug" + } + }, + { + "id": "secrets-197969de", + "type": "secrets", + "configuration": { + "keys": [ + "SCRAPING_BEE_KEY" + ] + }, + "metadata": { + "visual": { + "x": 25, + "y": 4.000000000000007 + }, + "title": "Get API Key", + "description": "Asking for API Key", + "logLevel": "debug" + } + }, + { + "id": "jsonata-02f9c069", + "type": "jsonata", + "configuration": { + "expression": "(\n $results := $eval(evaluate_results[0]);\n{ \"title\": body.title, \"body\": $results.data, \"links\": $results.links }\n)" + }, + "metadata": { + "visual": { + "x": 366, + "y": 500.99999999999994 + }, + "title": "Format Output", + "logLevel": "debug" + } + }, + { + "id": "jsonata-c018bbf7", + "type": "jsonata", + "configuration": { + "expression": "$string({ \"title\": \"title\" })", + "json": "{}" + }, + "metadata": { + "visual": { + "x": 23, + "y": 165.00000000000003 + }, + "title": "Extract Rules", + "description": "Specifying the rules to extract content", + "logLevel": "debug" + } + }, + { + "id": "jsonata-a145253b", + "type": "jsonata", + "metadata": { + "title": "JS Scenario", + "description": "Specifying JS to evaluate", + "logLevel": "debug", + "visual": { + "x": 17, + "y": 349 + } + }, + "configuration": { + "expression": "$string({\n \"instructions\":[ {\"evaluate\": $ }]\n})", + "json": "JSON.stringify({ data: document.body.innerText, links: Array.from(document.querySelectorAll(\"a\")).map((a) => ({ href: a.href, title: a.innerText.trim() }))})" + } + } + ], + "edges": [ + { + "from": "input", + "to": "urlTemplate-77553e6f", + "out": "url", + "in": "url" + }, + { + "from": "urlTemplate-77553e6f", + "to": "fetch-27da0eda", + "out": "url", + "in": "url" + }, + { + "from": "secrets-197969de", + "to": "urlTemplate-77553e6f", + "out": "SCRAPING_BEE_KEY", + "in": "SCRAPING_BEE_KEY" + }, + { + "from": "jsonata-02f9c069", + "to": "output", + "out": "result", + "in": "text" + }, + { + "from": "fetch-27da0eda", + "to": "jsonata-02f9c069", + "out": "response", + "in": "json" + }, + { + "from": "jsonata-c018bbf7", + "to": "urlTemplate-77553e6f", + "out": "result", + "in": "extract_rules" + }, + { + "from": "jsonata-a145253b", + "to": "urlTemplate-77553e6f", + "out": "result", + "in": "js_scenario" + } + ] +} \ No newline at end of file diff --git a/seeds/team-experiments/graphs/bgl/insta/tool-search.bgl.json b/seeds/team-experiments/graphs/bgl/insta/tool-search.bgl.json new file mode 100644 index 00000000..c53acff7 --- /dev/null +++ b/seeds/team-experiments/graphs/bgl/insta/tool-search.bgl.json @@ -0,0 +1,178 @@ +{ + "title": "Search the Web", + "description": "Given a term, searches the Web for it and returns a list of links and descriptions that match.", + "version": "0.0.1", + "nodes": [ + { + "type": "input", + "id": "input", + "configuration": { + "schema": { + "type": "object", + "properties": { + "search": { + "type": "string", + "title": "Search", + "examples": [], + "description": "The term to search the Web for" + } + }, + "required": [] + } + }, + "metadata": { + "visual": { + "x": 19, + "y": 538.0000000000001 + } + } + }, + { + "type": "output", + "id": "output", + "configuration": { + "schema": { + "type": "object", + "properties": { + "json": { + "type": "object", + "title": "JSON", + "examples": [] + } + }, + "required": [] + } + }, + "metadata": { + "visual": { + "x": 595, + "y": 505 + } + } + }, + { + "id": "fetch-27da0eda", + "type": "fetch", + "metadata": { + "visual": { + "x": 568.0000000000001, + "y": 151 + }, + "title": "Scraping Bee", + "description": "Calling Scraping Bee to Get the Contents", + "logLevel": "debug" + }, + "configuration": { + "method": "GET" + } + }, + { + "id": "urlTemplate-77553e6f", + "type": "urlTemplate", + "configuration": { + "template": "https://app.scrapingbee.com/api/v1/store/google?api_key={SCRAPING_BEE_KEY}&search={search}&language=en" + }, + "metadata": { + "visual": { + "x": 318, + "y": 193 + }, + "title": "Scraping Bee API Template", + "logLevel": "debug" + } + }, + { + "id": "secrets-197969de", + "type": "secrets", + "configuration": { + "keys": [ + "SCRAPING_BEE_KEY" + ] + }, + "metadata": { + "visual": { + "x": 25, + "y": 4 + }, + "title": "Get API Key", + "description": "Asking for API Key", + "logLevel": "debug" + } + }, + { + "id": "jsonata-02f9c069", + "type": "jsonata", + "configuration": { + "expression": "(\n $results := $eval(evaluate_results[0]);\n{ \"title\": body.title, \"body\": $results.data, \"links\": $results.links }\n)" + }, + "metadata": { + "visual": { + "x": 366, + "y": 501 + }, + "title": "Format Output", + "logLevel": "debug" + } + }, + { + "id": "jsonata-c018bbf7", + "type": "jsonata", + "configuration": { + "expression": "$string({ \"title\": \"title\" })", + "json": "{}" + }, + "metadata": { + "visual": { + "x": 23, + "y": 165 + }, + "title": "Extract Rules", + "description": "Specifying the rules to extract content", + "logLevel": "debug" + } + }, + { + "id": "jsonata-a145253b", + "type": "jsonata", + "metadata": { + "title": "JS Scenario", + "description": "Specifying JS to evaluate", + "logLevel": "debug", + "visual": { + "x": 17, + "y": 349 + } + }, + "configuration": { + "expression": "$string({\n \"instructions\":[ {\"evaluate\": $ }]\n})", + "json": "JSON.stringify({ data: document.body.innerText, links: Array.from(document.querySelectorAll(\"a\")).map((a) => ({ href: a.href, title: a.innerText.trim() }))})" + } + } + ], + "edges": [ + { + "from": "urlTemplate-77553e6f", + "to": "fetch-27da0eda", + "out": "url", + "in": "url" + }, + { + "from": "secrets-197969de", + "to": "urlTemplate-77553e6f", + "out": "SCRAPING_BEE_KEY", + "in": "SCRAPING_BEE_KEY" + }, + { + "from": "jsonata-02f9c069", + "to": "output", + "out": "result", + "in": "text" + }, + { + "from": "fetch-27da0eda", + "to": "jsonata-02f9c069", + "out": "response", + "in": "json" + } + ] +} \ No newline at end of file