File tree Expand file tree Collapse file tree 6 files changed +49
-365
lines changed
basics/generate-text/typescript Expand file tree Collapse file tree 6 files changed +49
-365
lines changed Original file line number Diff line number Diff line change 1+ # GenerateText in Typescript
2+
3+ To run this example,
4+
5+ ``` bash
6+ # Set your API key as an environment variable.
7+ # Get one here https://www.substrate.run/dashboard/keys if this is your first time.
8+ export SUBSTRATE_API_KEY=< your Substrate API key>
9+
10+ # Navigate to the python example directory.
11+ cd typescript
12+ ```
13+
14+ To run the example with tsx (default), run the following.
15+
16+ ``` bash
17+ npx tsx ./example.ts
18+ npx tsx ./example-multi.ts
19+
20+ # Or you can use the package.json scripts
21+ npm run example
22+ npm run example-multi
23+ ```
24+
25+ To run the example with Deno, uncomment the Deno sections in ` example.ts ` and
26+ run the following.
27+
28+ ``` bash
29+ deno run ./example.ts
30+ deno run ./example-multi.ts
31+ ```
Original file line number Diff line number Diff line change 1- #!/usr/bin/env -S npx ts-node --transpileOnly
2- import { Substrate , MultiComputeText } from "substrate" ;
1+ import { MultiComputeText , Substrate } from "substrate" ;
2+
3+ // Uncomment if using Deno
4+ // import process from "node:process";
35
46async function main ( ) {
57 const apiKey = process . env [ "SUBSTRATE_API_KEY" ] || "YOUR_API_KEY" ;
Original file line number Diff line number Diff line change 1- #!/usr/bin/env -S npx ts-node --transpileOnly
2- import { Substrate , ComputeText } from "substrate" ;
1+ import { ComputeText , Substrate } from "substrate" ;
2+
3+ // Uncomment if using Deno
4+ // import process from "node:process";
35
46async function main ( ) {
57 const apiKey = process . env [ "SUBSTRATE_API_KEY" ] || "YOUR_API_KEY" ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments