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/lab-7/README.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ As we will see throughout the documentation, LLMs can be incorporated into
11
11
software in a wide variety of ways. Some ways of incorporating LLMs into
12
12
programs tend to result in robust and performant systems, while others
13
13
result in software that is brittle and error-prone.
14
+
14
15
Generative programs are distinguished from classical programs by their use of
15
16
functions that invoke generative models. These generative calls can produce
16
17
many different data types — strings, booleans, structured data, code,
@@ -60,8 +61,10 @@ python3.11 -m venv venv
60
61
source venv/bin/activate
61
62
pip install mellea
62
63
```
63
-
Note: If you see something about the Rust compiler, please confirm you are using python3.11, or python3.12
64
-
anything above that has a Rust dependency.
64
+
65
+
!!! note
66
+
If you see something about the Rust compiler, please confirm you are using python3.11, or python3.12 anything above that has a Rust dependency.
67
+
65
68
2. Run a simple Mellea session:
66
69
```python
67
70
import mellea
@@ -74,8 +77,8 @@ you are set up to dig deeper with Mellea.
74
77
75
78
## Simple email examples
76
79
77
-
Note: The following work should be done via a text editor, there should be a couple installed on your
78
-
laptop, if you aren't sure raise your hand and a helper will help you out.
80
+
!!! note
81
+
The following work should be done via a text editor, there should be a couple installed on your laptop, if you aren't sure raise your hand and a helper will help you out.
79
82
80
83
Let's leverage Mellea to do some email generation for us, the first example is a simple example:
Most of this should look familiar by now, but the `validation_fn` and `check` should be new.
229
+
226
230
We create 3 requirements:
231
+
227
232
- First requirement (r1) will be validated by LLM-as-a-judge on the output of the instruction. This is the default behavior.
228
233
- Second requirement (r2) uses a function that takes the output of a sampling step and returns a boolean value indicating successful or unsuccessful validation. While the validation_fn parameter requires to run validation on the full session context, Mellea provides a wrapper for simpler validation functions (simple_validate(fn: Callable[[str], bool])) that take the output string and return a boolean as seen in this case.
229
234
- Third requirement is a check(). Checks are only used for validation, not for generation. Don't think mention purple elephants.
0 commit comments