diff --git a/examples/implicit-nodes.ts b/examples/implicit-nodes.ts index f8f190e..e2aa25b 100755 --- a/examples/implicit-nodes.ts +++ b/examples/implicit-nodes.ts @@ -8,15 +8,25 @@ async function main() { const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); const a = new GenerateText( - { prompt: "tell me about windmills" }, + { prompt: "tell me about windmills", max_tokens: 10 }, { id: "a" }, ); - const b = new GenerateText({ prompt: a.future.text }, { id: "b" }); - const c = new GenerateText({ prompt: b.future.text }, { id: "c" }); + const b = new GenerateText( + { prompt: a.future.text, max_tokens: 10 }, + { id: "b" }, + ); + const c = new GenerateText( + { prompt: b.future.text, max_tokens: 10 }, + { id: "c" }, + ); + const d = new GenerateText( + { prompt: c.future.text, max_tokens: 10 }, + { id: "d" }, + ); // 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); + const res = await substrate.run(d); console.log(res.json); } main(); diff --git a/src/Substrate.ts b/src/Substrate.ts index eb164db..645ca47 100644 --- a/src/Substrate.ts +++ b/src/Substrate.ts @@ -120,8 +120,9 @@ export class Substrate { return res; } else { + const requestId = request.headers.get("x-substrate-request-id"); throw new SubstrateError( - `Request failed: ${apiResponse.status} ${apiResponse.statusText}`, + `[Request failed] status=${apiResponse.status} statusText=${apiResponse.statusText} requestId=${requestId}`, ); } } catch (err: unknown) {