Creating a Node is easy - it's just an async function!
A Node function receives two parameters - input
and apiKeys
:
- The
input
is either aRecord<string, any>
or aReadableStream
. - The
apiKeys
is aRecord<string, string>
that contains all API Keys that were passed into the Aigur Client instance. You can use them for your API calls.
💡
The Node function must return a Promise
that resolves to the output of the Node (Record<string, any>
or a ReadableStream
).
Simple Example
Here is an example of a Node that greets its input:
Using Runtime Validators (Optional)
You can use runtime schema validators/parsers such as Zod (opens in a new tab) to validate the input and output of your Node.