-
Notifications
You must be signed in to change notification settings - Fork 1
Updated Docs for Render Template #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -273,3 +273,15 @@ hide: | |||||
* Currently we have to create it manually through the admin dashboard, but a near future release will include a dedicated page to view/edit participant data. | ||||||
* Please note that participant data is experiment specific, meaning that data we have for a participant in one | ||||||
experiment may not be the same for the next experiment. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrase 'meaning that data we have for a participant in one experiment may not be the same for the next experiment' can be made more concise.
Suggested change
|
||||||
|
||||||
## Mar 11, 2025 | ||||||
|
||||||
* **NEW** Updated Render Template node context | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The term 'RenderTemplate' should be consistently formatted, either as 'Render Template' or 'RenderTemplate'.
Suggested change
|
||||||
* The RenderTemplate node now provides more context for Jinja templates, allowing dynamic rendering without an additional Code Node. | ||||||
* The template context includes the following variables: | ||||||
- `input`: The node’s input (string). | ||||||
- `temp_state`: Pipeline temporary state (dict). | ||||||
- `participant_details`: Participant details with `identifier` and `platform` keys (dict). | ||||||
- `participant_data`: Participant data | ||||||
- `participant_schedules`: Participant schedule data (list). | ||||||
* This enhancement enables templates to access participant details, pipeline state, and other session data directly, improving flexibility for nodes like `SendEmail`. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -127,6 +127,52 @@ content = attachment.read_text() | |||||
## Template | ||||||
Renders a [Jinja](https://jinja.palletsprojects.com/en/stable/templates/) template. | ||||||
|
||||||
The RenderTemplate node ensures that the template node can access and render content dynamically based on participant details, pipeline temporary state, participant data, participant schedules, and the node’s input. This eliminates the need for an additional Code Node to configure the context. | ||||||
|
||||||
### Available Template Variables | ||||||
The following variables are available in the template context: | ||||||
|
||||||
| Key | Description | Type | | ||||||
|-------------------------|------------------------------------------------|--------| | ||||||
| `input` | The input to the node | String | | ||||||
| `temp_state` | Pipeline temporary state | Dict | | ||||||
| `participant_details` | Participant details (`identifier`, `platform`) | Dict | | ||||||
| `participant_data` | Participant data | Dict | | ||||||
| `participant_schedules` | Participant schedule data | List | | ||||||
|
||||||
### Sample State | ||||||
`json | ||||||
{ | ||||||
"experiment_session": { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this example an example of what a real context might look like? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this is just a simplified example for real Pipeline State object |
||||||
"participant": { | ||||||
"identifier": "participant_123", | ||||||
"platform": "web" | ||||||
} | ||||||
}, | ||||||
"messages": ["Cycling"], | ||||||
"temp_state": { | ||||||
"my_key": "example_key" | ||||||
}, | ||||||
"pipeline_version": 1, | ||||||
"outputs": {} | ||||||
}` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The JSON format in 'Sample State' section is missing a closing brace.
Suggested change
|
||||||
|
||||||
### Sample Template | ||||||
`Input: {{ input }} | ||||||
Temp State Key: {{ temp_state.my_key }} | ||||||
Participant ID: {{ participant_details.identifier }} | ||||||
Participant Platform: {{ participant_details.platform }} | ||||||
Participant Data: {{ participant_data.custom_key }} | ||||||
Schedules: {{ participant_schedules }} | ||||||
` | ||||||
### Sample Output | ||||||
`Input: Cycling | ||||||
Temp State Key: example_key | ||||||
Participant ID: participant_123 | ||||||
Participant Platform: web | ||||||
Participant Data: custom_value | ||||||
Schedules: [] | ||||||
` | ||||||
Send the input to the specified list of email addresses. This node acts as a passthrough, meaning the output will be identical to the input, allowing it to be used in a pipeline without affecting the conversation. | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase 'but a near future release' should be revised for clarity.