1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from evaluator import *

DESCRIPTION = "A for-fun test to see if the model can go movie title -> emoji -> movie title."

TAGS = ['fun']

question = """
For each of the following ten movies give at most 5 emoji that would best describe the movie.

Give your answer as a JSON array. So If I asked for
```["Finding Nemo", "Toy Story"]```

you might might answer

```json
{"Finding Nemo": ["🐠", "🐟", "🐡", "🐬", "🐳"],
"Toy Story": ["🚀", "⚔️,", "🤖", "👽", "🌌"]}
```.

Each emoji must be a single utf8 character. ABSOLUTELY NO ZERO WIDTH JOINING. (So, max(len(emoji) for movie in result.values() for emoji in movie) == 1)

Now give me answers for these movies:

```["The Lion King", "The Nightmare Before Christmas", "The Godfather", "The Matrix", "Casablanca", "Raiders of the Lost Ark", "V for Vendetta", "The Princess Bride", "Back to the Future", "Dune"]```

Give ONLY a JSON output. Nothing else.
"""

undo = """
For each of the following ten movies described by 5 emoji, give the movie title that best matches.

Give your answer as a JSON list. So If I asked for
```[["🐠", "🐟", "🐡", "🐬", "🐳"], ["🚀", "⚔️,", "🤖", "👽", "🌌"]]```

You might answer

```json
["Finding Nemo", "Toy Story"]]
```.

Now give me answers for these movies:

```<A>```

What are the names of the movie titles?
"""

def extract(x):
    try:
        x = json.loads(x)
    except:
        print("Failed processing")
        return ""
    send = list(x.values())
    # I'll be nice...
    send = [[x for x in y if len(x) <= 2] for y in send]
    return str(send).replace("], [", "],\n[")

def count(x):
    try:
        x = json.loads(x)
        count = 0
        for correct, guessed in zip(["The Lion King", "The Nightmare Before Christmas", "The Godfather", "The Matrix", "Casablanca", "Raiders of the Lost Ark", "V for Vendetta", "The Princess Bride", "Back to the Future", "Dune"], x):
            if correct.lower() == guessed.lower():
                count += 1
        return count >= 8, "OK"
    except:
        return False, "Not a JSON list"


TestEmojiMovie = question >> LLMRun() >> ExtractJSON() >> PyFunc(extract) >> LLMRun(undo) >> ExtractJSON() >> PyFunc(count)

if __name__ == "__main__":
    print(run_test(TestEmojiMovie))