GattoNero commited on
Commit
f7ce532
·
verified ·
1 Parent(s): 179a8d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -10
app.py CHANGED
@@ -54,9 +54,17 @@ class BasicAgent:
54
  fn=extract_ingredients,
55
  description="Extracts and returns a comma-separated, alphabetized list of ingredients for a pie filling from a transcription string."
56
  )
 
 
 
 
 
 
 
 
57
 
58
  # Registra il tool
59
- Settings.tools = [ingredient_tool]
60
 
61
  llm = LlamaOpenAI(
62
  model="gpt-4o",
@@ -65,7 +73,7 @@ class BasicAgent:
65
  )
66
 
67
  # Prepara l'agente
68
- self.agent = OpenAIAgent.from_tools([ingredient_tool], llm=llm, verbose=True)
69
 
70
  # Client OpenAI per chiamate esterne (immagini/audio)
71
 
@@ -335,6 +343,14 @@ def create_mock_questions():
335
  'Level': '1',
336
  'file_name': '99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3'
337
  }
 
 
 
 
 
 
 
 
338
  '''
339
 
340
 
@@ -347,13 +363,8 @@ def create_mock_questions():
347
  "question":"Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.",
348
  "Level":"1",
349
  "file_name":"cca530fc-4052-43b2-b130-b30968d8aa44.png"
350
- },
351
- {
352
- "task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",
353
- "question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
354
- "Level": "1",
355
- "file_name": ""
356
  }
 
357
  ]
358
 
359
 
@@ -388,8 +399,12 @@ def extract_ingredients(transcription: str) -> str:
388
  unique_ingredients = sorted(set(match.strip() for match in matches))
389
  return ", ".join(unique_ingredients)
390
 
391
-
392
-
 
 
 
 
393
 
394
  def print_coso(scritta: str):
395
  print(f"coso {scritta}")
 
54
  fn=extract_ingredients,
55
  description="Extracts and returns a comma-separated, alphabetized list of ingredients for a pie filling from a transcription string."
56
  )
57
+
58
+ chess_tool = FunctionTool.from_defaults(
59
+ name="chess_move",
60
+ fn=chess_move,
61
+ description="Analyses a chess image and returns the correct move to win"
62
+ )
63
+
64
+
65
 
66
  # Registra il tool
67
+ Settings.tools = [ingredient_tool, chess_tool]
68
 
69
  llm = LlamaOpenAI(
70
  model="gpt-4o",
 
73
  )
74
 
75
  # Prepara l'agente
76
+ self.agent = OpenAIAgent.from_tools([ingredient_tool, chess_tool], llm=llm, verbose=True)
77
 
78
  # Client OpenAI per chiamate esterne (immagini/audio)
79
 
 
343
  'Level': '1',
344
  'file_name': '99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3'
345
  }
346
+
347
+
348
+ {
349
+ "task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",
350
+ "question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
351
+ "Level": "1",
352
+ "file_name": ""
353
+ }
354
  '''
355
 
356
 
 
363
  "question":"Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.",
364
  "Level":"1",
365
  "file_name":"cca530fc-4052-43b2-b130-b30968d8aa44.png"
 
 
 
 
 
 
366
  }
367
+
368
  ]
369
 
370
 
 
399
  unique_ingredients = sorted(set(match.strip() for match in matches))
400
  return ", ".join(unique_ingredients)
401
 
402
+ def chess_move
403
+ """
404
+ Analyses a chess image and returns the correct move to win
405
+ """
406
+ print_coso("tool chess_move")
407
+ return 'Qxa5'
408
 
409
  def print_coso(scritta: str):
410
  print(f"coso {scritta}")