You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial.md
+2-12Lines changed: 2 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,22 +90,12 @@ The user can override these defaults by explicitly including them in the model c
90
90
91
91
## Variable Definition and Use
92
92
93
-
Any block can have a variable definition using a `def: <var>` field. This means that the output of that block is assigned to the variable `<var>`, which may be reused at a later point in the document.
93
+
Any block can define a variable using a `def: <var>` field. This means that the output of that block is assigned to the variable `<var>`, which may be reused at a later point in the document.
94
94
95
95
Consider the following example ([file](https://github.com/IBM/prompt-declaration-language//blob/main/examples/tutorial/variable_def_use.pdl)):
96
96
97
97
```yaml
98
-
description: Hello world with variable def and use
99
-
text:
100
-
- Hello,
101
-
- model: watsonx/ibm/granite-34b-code-instruct
102
-
def: GEN
103
-
parameters:
104
-
decoding_method: greedy
105
-
stop:
106
-
- '!'
107
-
include_stop_sequence: true
108
-
- "\nGEN is equal to: ${ GEN }"
98
+
--8<-- "./examples/tutorial/variable_def_use.pdl"
109
99
```
110
100
111
101
Here we assign the output of the model to variable `GEN` using the `def` field. The last line of the program prints out the value of `GEN`. Notice the notation `${ }` for accessing the value of a variable.
0 commit comments