Skip to content

Commit 73fbb1b

Browse files
committed
also update the generate text example
1 parent a3bb05d commit 73fbb1b

File tree

6 files changed

+49
-365
lines changed

6 files changed

+49
-365
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
```

basics/generate-text/typescript/example-multi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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

46
async function main() {
57
const apiKey = process.env["SUBSTRATE_API_KEY"] || "YOUR_API_KEY";

basics/generate-text/typescript/example.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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

46
async function main() {
57
const apiKey = process.env["SUBSTRATE_API_KEY"] || "YOUR_API_KEY";

basics/generate-text/typescript/package-lock.json

Lines changed: 0 additions & 337 deletions
This file was deleted.

0 commit comments

Comments
 (0)