sgongora27 commited on
Commit
6041378
1 Parent(s): a6e4a80

World 2 Now in english

Browse files
Files changed (3) hide show
  1. example_worlds.py +53 -2
  2. models.py +2 -3
  3. prompts.py +2 -0
example_worlds.py CHANGED
@@ -226,13 +226,13 @@ def get_world_2_spanish() -> World:
226
  place_1.block_passage(place_2, item_3)
227
 
228
  place_3 = Location("Celda",
229
- ["Una celda cuadrada de dos metros cuadrados", "Las vegetación del monte ya ha ingresado al interior"])
230
  place_3.connecting_locations = [place_2]
231
  place_2.connecting_locations = [place_3]
232
  place_2.block_passage(place_3,puzzle_1)
233
 
234
  npc = Character("José Artigas",
235
- ["El héroe nacional de Uruguay", "Está cansado, de estar tanto tiempo encerrado"],
236
  inventory = [],
237
  location = place_3)
238
 
@@ -247,4 +247,55 @@ def get_world_2_spanish() -> World:
247
  the_world.add_character(npc)
248
  the_world.set_objective(player,npc)
249
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  return the_world
 
226
  place_1.block_passage(place_2, item_3)
227
 
228
  place_3 = Location("Celda",
229
+ ["Una celda cuadrada de dos metros cuadrados", "La vegetación del monte ya ha ingresado al interior"])
230
  place_3.connecting_locations = [place_2]
231
  place_2.connecting_locations = [place_3]
232
  place_2.block_passage(place_3,puzzle_1)
233
 
234
  npc = Character("José Artigas",
235
+ ["El héroe nacional de Uruguay", "Está muy debilitado al estar tanto tiempo encerrado"],
236
  inventory = [],
237
  location = place_3)
238
 
 
247
  the_world.add_character(npc)
248
  the_world.set_objective(player,npc)
249
 
250
+ return the_world
251
+
252
+ def get_world_2_english() -> World:
253
+
254
+ item_1 = Item("Writings",
255
+ ["There is something written on the wall.", "It says 'You have to trust in the powers that have been given to you.'"],
256
+ gettable=False)
257
+ item_2 = Item("Pond",
258
+ ["A pond full of crystal clear water", "The water is so clear that it works like a mirror"],
259
+ gettable=False)
260
+ item_3 = Item("Firewall",
261
+ ["The flames are very hot", "It's 3 metres high", "It is impossible to cross them, neither walking, nor running, nor jumping."],
262
+ gettable=False)
263
+ item_4 = Item("Guitar",
264
+ ["A classic guitar with 6 strings", "It sounds great"])
265
+
266
+ puzzle_1 = Puzzle("Puzzle",
267
+ ["A strong magic is generating an impassable wall", "Magically, as you get closer, some blue letters appear explaining what the riddle to solve is."],
268
+ "You have to whisper the name of the river located on the southern coast of the Banda Oriental", "Rio de la Plata")
269
+
270
+ place_1 = Location ("Clearing in the woods",
271
+ ["A clearing in a eucalyptus forest near the Uruguay River", "You can hear the sound of the animals that live in the trees of this forest."],
272
+ items = [item_1, item_2])
273
+ place_2 = Location("Silent zone",
274
+ ["The forest continues in this part", "Unlike the previous area, this area is very silent and not even the slightest sound can be heard."])
275
+ place_2.connecting_locations = [place_1]
276
+ place_1.connecting_locations = [place_2]
277
+ place_1.block_passage(place_2, item_3)
278
+
279
+ place_3 = Location("Cell",
280
+ ["A square cell of two square meters", "The interior is full of plants that grew outside"])
281
+ place_3.connecting_locations = [place_2]
282
+ place_2.connecting_locations = [place_3]
283
+ place_2.block_passage(place_3,puzzle_1)
284
+
285
+ npc = Character("José Artigas",
286
+ ["Uruguay's national hero", "He is very weak after being locked up for so long."],
287
+ inventory = [],
288
+ location = place_3)
289
+
290
+ player = Character("Venancio",
291
+ ["A Uruguayan gaucho in his 40s", "He belongs to the Artigas army", "He has the magical power to summon a giant wave of water with which he can put out fires or moisten the ground."],
292
+ inventory = [item_4],
293
+ location= place_1)
294
+
295
+ the_world = World(player)
296
+ the_world.add_locations([place_1,place_2,place_3])
297
+ the_world.add_items([item_1,item_2,item_3])
298
+ the_world.add_character(npc)
299
+ the_world.set_objective(player,npc)
300
+
301
  return the_world
models.py CHANGED
@@ -1,11 +1,10 @@
1
  """Load models to use them as a narrator and a common-sense oracle in the PAYADOR pipeline."""
2
  import google.generativeai as genai
3
  import requests
4
- import os
5
 
6
 
7
  class GeminiModel():
8
- def __init__ (self, api_key_file:str, model_name:str = "gemini-pro") -> None:
9
  """"Initialize the Gemini model using an API key."""
10
  self.safety_settings = [
11
  {
@@ -29,7 +28,7 @@ class GeminiModel():
29
  "threshold": "BLOCK_NONE",
30
  },
31
  ]
32
- genai.configure(api_key=os.getenv(api_key_file))
33
  self.model = genai.GenerativeModel(model_name)
34
 
35
  def prompt_model(self,prompt: str) -> str:
 
1
  """Load models to use them as a narrator and a common-sense oracle in the PAYADOR pipeline."""
2
  import google.generativeai as genai
3
  import requests
 
4
 
5
 
6
  class GeminiModel():
7
+ def __init__ (self, api_key_file:str, model_name:str = "gemini-1.0-pro") -> None:
8
  """"Initialize the Gemini model using an API key."""
9
  self.safety_settings = [
10
  {
 
28
  "threshold": "BLOCK_NONE",
29
  },
30
  ]
31
+ genai.configure(api_key=get_api_key(api_key_file))
32
  self.model = genai.GenerativeModel(model_name)
33
 
34
  def prompt_model(self,prompt: str) -> str:
prompts.py CHANGED
@@ -20,6 +20,8 @@ def prompt_describe_objective_english (objective) -> str:
20
  prompt+= f'"<{objective[0].name}> has to get the item <{objective[1].name}>."'
21
  elif first_component_class == "Item" and second_component_class == "Location":
22
  prompt+= f'"You have to leave item <{objective[0].name}> in place <{objective[1].name}>."'
 
 
23
 
24
  prompt+="\nPut your generated narration between # characters. For example: # You have to get the <key> # or # You have to reach the <castle> #"
25
 
 
20
  prompt+= f'"<{objective[0].name}> has to get the item <{objective[1].name}>."'
21
  elif first_component_class == "Item" and second_component_class == "Location":
22
  prompt+= f'"You have to leave item <{objective[0].name}> in place <{objective[1].name}>."'
23
+ elif first_component_class == "Character" and second_component_class == "Character":
24
+ prompt+= f'"<{objective[0].name}> has to find <{objective[1].name}>."'
25
 
26
  prompt+="\nPut your generated narration between # characters. For example: # You have to get the <key> # or # You have to reach the <castle> #"
27