docs: playground on TS sdk (#213)

This commit is contained in:
abelanger5
2024-02-28 22:01:01 -08:00
committed by GitHub
parent 70edf5d928
commit 68093b3e55
@@ -273,4 +273,27 @@ const workflow: Workflow = {
},
steps: [...],
};
```
```
## Playground Values
Playground values are a way to override variables within a workflow from the Hatchet UI. For example, you could use this to make a prompt or temperature value for an LLM workflow configurable from the UI. These values can be set via the `ctx.playground` method:
```ts
await worker.registerWorkflow({
id: 'playground-demo',
description: 'This is a demo of the playground',
steps: [
{
name: 'playground',
run: (ctx: Context<any, any>) => {
const prompt = ctx.playground('prompt', 'This is an example prompt');
return { step1: playground };
},
},
],
});
```
This will then appear in the Hatchet UI under the `prompt` value.