Skip to content

Commit 3b86116

Browse files
authored
Merge pull request #30 from jbusche/jim-lab7-tweaks
Adding copy, footer, lab7 items
2 parents ad9dbd6 + e5de45c commit 3b86116

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Our overarching goals of this workshop is as follows:
3131
| [Lab 4: Applying What You Learned](lab-4/README.md) | Refine your prompting skills |
3232
| [Lab 5: Building a local AI Assistant](lab-5/README.md) | Build a Granite coding assistant |
3333
| [Lab 6: Coding with an AI Assistant](lab-6/README.md) | Write code using Continue and Granite |
34+
| [Lab 7: Using Mellea to help with Generative Computing](lab-7/README.md) | Learn how to leverage Mellea for Advanced AI situations |
3435

3536
Thank you SO MUCH for joining us in this workshop! If you have any questions or feedback,
3637
the TAs would love answer them for you. If you come across any issues or bugs, don't hesitate

docs/lab-7/README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ and brittle prompts with structured, maintainable, robust, and efficient AI work
5555

5656
## Let's setup Mellea to work locally
5757

58-
1. Open up a terminal, and run the following commands:
58+
1. Open up a terminal, and run the following commands:
5959
```bash
6060
python3.11 -m venv venv
6161
source venv/bin/activate
@@ -65,7 +65,12 @@ pip install mellea
6565
!!! note
6666
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.
6767

68-
2. Run a simple Mellea session:
68+
1. Start python:
69+
```bash
70+
python
71+
```
72+
73+
1. Run a simple Mellea session:
6974
```python
7075
import mellea
7176

@@ -75,27 +80,32 @@ print(m.chat("What is the etymology of mellea?").content)
7580
You can either add this to a file like `main.py` or run it in the python REPL, if you get output
7681
you are set up to dig deeper with Mellea.
7782

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+
7886
## Simple email examples
7987

8088
!!! note
8189
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.
8290

83-
Let's leverage Mellea to do some email generation for us, the first example is a simple example:
91+
1. Let's leverage Mellea to do some email generation for us, the first example is a simple example:
8492
```python
8593
import mellea
8694
m = mellea.start_session()
8795

8896
email = m.instruct("Write an email inviting interns to an office party at 3:30pm.")
8997
print(str(email))
9098
```
91-
As you can see, it outputs a standard email with only a couple lines of code, lets expand on this:
99+
100+
1. As you can see, it outputs a standard email with only a couple lines of code, lets expand on this:
92101
```python
93102
import mellea
94103
m = mellea.start_session()
95104

96105
def write_email(m: mellea.MelleaSession, name: str, notes: str) -> str:
97106
email = m.instruct(
98107
"Write an email to {{name}} using the notes following: {{notes}}.",
108+
user_variables={"name": name, "notes": notes},
99109
)
100110
return email.value # str(email) also works.
101111

@@ -106,15 +116,15 @@ print(
106116
"Olivia",
107117
"Olivia helped the lab over the last few weeks by organizing intern events, advertising the speaker series, and handling issues with snack delivery.",
108118
)
109-
) user_variables={"name": name, "notes": notes},
119+
)
110120
```
111121
With this more advance example we now have the ability to customize the email to be more directed and
112122
personalized for the recipient. But this is just a more programmatic prompt engineering, lets see where
113123
Mellea really shines.
114124

115125
### Simple email with boundries and requirements
116126

117-
The first step with the power of Mellea, is adding requirements to something like this email, take a look at this first
127+
1. The first step with the power of Mellea, is adding requirements to something like this email, take a look at this first
118128
example:
119129
```python
120130
import mellea
@@ -152,7 +162,7 @@ Let's create an email with some sampling and have Mellea, find the best option f
152162
We add two requirements to the instruction which will be added to the model request.
153163
But we don't check yet if these requirements are satisfied, we add a strategy for validating the requirements.
154164

155-
This sampling strategy (`RejectionSamplingStrategy()`) checks if all requirements are met and if any requirement fails, the sampling strategy will sample a new email from the LLM.
165+
1. This sampling strategy (`RejectionSamplingStrategy()`) checks if all requirements are met and if any requirement fails, the sampling strategy will sample a new email from the LLM.
156166
```python
157167
import mellea
158168
m = mellea.start_session()
@@ -192,7 +202,7 @@ writing you expect is within the boundaries and it'll keep trying till it gets i
192202

193203
## Instruct Validate Repair
194204

195-
The first `instruct-validate-repair` pattern is as follows:
205+
1. The first `instruct-validate-repair` pattern is as follows:
196206

197207
```python
198208
import mellea

mkdocs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ nav:
2626
## DO NOT CHANGE BELOW THIS LINE
2727

2828
# Copyright
29-
copyright: Copyright © 2024- IBM Research
29+
copyright: Copyright © 2025- IBM Research
3030

3131
# Theme
3232
theme:
@@ -40,7 +40,10 @@ theme:
4040
favicon: images/favicon.ico
4141
features:
4242
- navigation.tabs
43+
- navigation.footer
4344
#- navigation.instant
45+
- content.code.copy
46+
- content.tabs.link
4447
palette:
4548
scheme: default
4649
primary: blue

0 commit comments

Comments
 (0)