-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86280dc
commit 07d2fe6
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env -S npx ts-node --transpileOnly | ||
|
||
import { Substrate, GenerateText } from "substrate"; | ||
|
||
async function main() { | ||
const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"]; | ||
|
||
const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); | ||
|
||
const a = new GenerateText( | ||
{ prompt: "tell me about windmills" }, | ||
{ id: "a" }, | ||
); | ||
const b = new GenerateText({ prompt: a.future.text }, { id: "b" }); | ||
const c = new GenerateText({ prompt: b.future.text }, { id: "c" }); | ||
|
||
// Because the `c` is the the final node in the graph we can find nodes it depends | ||
// on through the relationships created via the input arguments. | ||
const res = await substrate.run(c); | ||
console.log(res.json); | ||
} | ||
main(); |