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-5/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ Go ahead and save it to your local machine, and be ready to grab it.
95
95
!!! note
96
96
Granite 4 has newer data, so since this lab was created, it DOES have the 2024 data. If you find that's the case, you can try it with the question about 2025 using the 2025 full-year budget using the link below.
Copy file name to clipboardExpand all lines: docs/lab-7/README.md
+4-9Lines changed: 4 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,14 +75,11 @@ python
75
75
import mellea
76
76
77
77
m = mellea.start_session()
78
-
print(m.chat("What is the etymology of mellea?").content)
78
+
print(m.chat("tell me some fun trivia about IBM and the early history of AI.").content)
79
79
```
80
80
You can either add this to a file like `main.py` or run it in the python REPL, if you get output
81
81
you are set up to dig deeper with Mellea.
82
82
83
-
!!! note
84
-
If you see an error message with: "ModuleNotFoundError: No module named 'PIL'" then you will need to install the python package pillow with "pip install pillow"
85
-
86
83
## Simple email examples
87
84
88
85
!!! note
@@ -158,7 +155,7 @@ by changing from "only lower-case" to "only upper-case" and see that it will fol
158
155
159
156
Pretty neat eh? Lets go even deeper.
160
157
161
-
Let's create an email with some sampling and have Mellea, find the best option for what we are looking for:
158
+
Let's create an email with some sampling and have Mellea find the best option for what we are looking for:
162
159
We add two requirements to the instruction which will be added to the model request.
163
160
But we don't check yet if these requirements are satisfied, we add a strategy for validating the requirements.
164
161
@@ -196,9 +193,7 @@ print(
196
193
)
197
194
)
198
195
```
199
-
You might notice it fails with the above example, just remove the `"Use only lower-case letters",` line, and
200
-
it should pass on the first re-run. This brings up some interesting opportunities, so make sure that the
201
-
writing you expect is within the boundaries and it'll keep trying till it gets it right.
196
+
You might notice it fails with the above example, because the name "Olivia" has an upper-case letter in it. Remove the `"Use only lower-case letters",` line, and it should pass on the first re-run. This brings up some interesting opportunities, so make sure that the writing you expect is within the boundaries and it'll keep trying till it gets it right.
202
197
203
198
## Instruct Validate Repair
204
199
@@ -241,7 +236,7 @@ We create 3 requirements:
241
236
242
237
- First requirement (r1) will be validated by LLM-as-a-judge on the output of the instruction. This is the default behavior.
243
238
- 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.
244
-
- Third requirement is a check(). Checks are only used for validation, not for generation. Don't think mention purple elephants.
239
+
- Third requirement is a check(). Checks are only used for validation, not for generation. Checks aim to avoid the "do not think about B" effect that often primes models (and humans) to do the opposite and "think" about B.
245
240
246
241
Run this in your local instance, and you'll see it working, and ideally no purple elephants! :)
0 commit comments