Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- game/engine.py +12 -2
game/engine.py
CHANGED
|
@@ -169,8 +169,18 @@ RARITY_CLUES = {
|
|
| 169 |
"Legendary": "The whole clearing goes quiet — this mushroom hides part of the Elder Map.",
|
| 170 |
}
|
| 171 |
|
| 172 |
-
#
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
system_prompt = f"You are a guide in a forest. Here are the mushrooms you can find: {mushroom_context}"
|
| 175 |
|
| 176 |
# ---------------------------------------------------------------------------
|
|
|
|
| 169 |
"Legendary": "The whole clearing goes quiet — this mushroom hides part of the Elder Map.",
|
| 170 |
}
|
| 171 |
|
| 172 |
+
# 1. Get the tuple of objects from your function
|
| 173 |
+
mushroom_objects = load_mushrooms()
|
| 174 |
+
|
| 175 |
+
# 2. Convert each object into a dictionary
|
| 176 |
+
# (Assuming your Mushroom class has a .to_dict() method.
|
| 177 |
+
# If it doesn't, you can use vars(m) instead of m.to_dict())
|
| 178 |
+
mushroom_list_of_dicts = [m.to_dict() for m in mushroom_objects]
|
| 179 |
+
|
| 180 |
+
# 3. Now it is safe to dump to JSON
|
| 181 |
+
mushroom_context = json.dumps(mushroom_list_of_dicts)
|
| 182 |
+
|
| 183 |
+
# 4. Now create your prompt
|
| 184 |
system_prompt = f"You are a guide in a forest. Here are the mushrooms you can find: {mushroom_context}"
|
| 185 |
|
| 186 |
# ---------------------------------------------------------------------------
|