pilgrim-65 commited on
Commit
a0669d3
·
1 Parent(s): e041c2f

README modified with clarifications

Browse files
Files changed (3) hide show
  1. README.md +29 -26
  2. agent.py +5 -4
  3. chess_tool.py +4 -2
README.md CHANGED
@@ -18,29 +18,32 @@ short_description: Final Assignment for agents course
18
 
19
  The graph is built with LangGraph framework. There is a control of iterations between the agent and the tools node, with a field in the state. The **route_tools** function checks if the **iterations** number, updated in the **increase** node, is greater than the stablished in MAX_ITERATIONS constant.
20
 
21
- ```mermaid
22
- ---
23
- config:
24
- flowchart:
25
- curve: linear
26
- ---
27
- graph TD;
28
- __start__([<p>__start__</p>]):::first
29
- input(input)
30
- agent(agent)
31
- increase(increase)
32
- tools(tools)
33
- final_output(final_output)
34
- __end__([<p>__end__</p>]):::last
35
- __start__ --> input;
36
- agent -. &nbsp;final_output&nbsp; .-> final_output;
37
- agent -. &nbsp;tools&nbsp; .-> increase;
38
- increase --> tools;
39
- input --> agent;
40
- tools --> agent;
41
- final_output --> __end__;
42
- classDef default fill:#f2f0ff,line-height:1.2
43
- classDef first fill-opacity:0
44
- classDef last fill:#bfb6fc
45
-
46
- ```
 
 
 
 
18
 
19
  The graph is built with LangGraph framework. There is a control of iterations between the agent and the tools node, with a field in the state. The **route_tools** function checks if the **iterations** number, updated in the **increase** node, is greater than the stablished in MAX_ITERATIONS constant.
20
 
21
+ ### Models
22
+ I have tried two different models so far.
23
+ * **gemini-2.5-flash**. This is free to use, taking advantage of the generous limits provided by Google AI for developers.
24
+ * **gpt-oss-120b**. I have used it through HuggingFace inference providers. Since I have a pro account, 2$/month is more than enough to develop the Final Assignment project.
25
+ This model, **gpt-oss-120b, does not work through _Together_ inference provider**. It seems that Together is not performing well with LangGraph. It worked just fine through **_Fireworks_** inference provider.
26
+
27
+ ### Tools
28
+ * python_tool
29
+ * reverse_tool
30
+ * excel_file_to_markdown
31
+ * sum_numbers
32
+ * web_search
33
+ * get_wikipedia_info
34
+ * ask_audio_model
35
+ * chess_tool (this one cannot run on HuggingFace Space)
36
+
37
+
38
+ ### Results
39
+
40
+ The answers of the two models were cached after generation, and then submitted. I modified the gradio app to do so, as suggested in the template comments
41
+
42
+ * gemini-2.5-flash. 40%
43
+ * gpt-oss-120b. 60%
44
+ * combined (taking correct results from both models): 65%. Only one additional answer provided by gemini.
45
+
46
+
47
+
48
+
49
+
agent.py CHANGED
@@ -17,8 +17,8 @@ from tools import (
17
  )
18
  from chess_tool import chess_tool
19
 
20
- MODEL_PROVIDER = "gemini"
21
- # MODEL_PROVIDER = "openai"
22
 
23
  MAX_ITERATIONS = 5
24
 
@@ -38,13 +38,14 @@ llm_gemini = ChatGoogleGenerativeAI(
38
  model="gemini-2.5-flash",
39
  include_thoughts=False,
40
  temperature=0,
41
- max_output_tokens=256,
42
  timeout=60, # The maximum number of seconds to wait for a response.
43
  max_retries=2,
44
  )
45
 
46
  llm_openai = ChatOpenAI(
47
- model="openai/gpt-oss-120b:together",
 
48
  temperature=0,
49
  max_tokens=None, # type: ignore
50
  timeout=60,
 
17
  )
18
  from chess_tool import chess_tool
19
 
20
+ # MODEL_PROVIDER = "gemini"
21
+ MODEL_PROVIDER = "openai"
22
 
23
  MAX_ITERATIONS = 5
24
 
 
38
  model="gemini-2.5-flash",
39
  include_thoughts=False,
40
  temperature=0,
41
+ max_output_tokens=None,
42
  timeout=60, # The maximum number of seconds to wait for a response.
43
  max_retries=2,
44
  )
45
 
46
  llm_openai = ChatOpenAI(
47
+ # model="openai/gpt-oss-120b:together",
48
+ model="openai/gpt-oss-120b:fireworks-ai",
49
  temperature=0,
50
  max_tokens=None, # type: ignore
51
  timeout=60,
chess_tool.py CHANGED
@@ -15,7 +15,7 @@ def chess_tool(task_id: str, color_to_move: str) -> str:
15
  Given an image of a chessboard, and the color to move,
16
  predict the FEN notation and suggest the best move.
17
  https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation
18
-
19
  Args:
20
  task_id (str): The identifier for the chessboard image.
21
  color_to_move (str): 'w' or 'b', the color to move ('white' or 'black').
@@ -44,5 +44,7 @@ def chess_tool(task_id: str, color_to_move: str) -> str:
44
  stockfish.set_fen_position(fen)
45
  best_move = stockfish.get_best_move()
46
  logger.info(f"Best move determined: {best_move!r}")
 
 
47
 
48
- return best_move #type: ignore
 
15
  Given an image of a chessboard, and the color to move,
16
  predict the FEN notation and suggest the best move.
17
  https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation
18
+ Important: the output of this tool is not to be modified in any way.
19
  Args:
20
  task_id (str): The identifier for the chessboard image.
21
  color_to_move (str): 'w' or 'b', the color to move ('white' or 'black').
 
44
  stockfish.set_fen_position(fen)
45
  best_move = stockfish.get_best_move()
46
  logger.info(f"Best move determined: {best_move!r}")
47
+ piece = stockfish.get_what_is_on_square(best_move[:2]) # type:ignore
48
+ next_move_fen = piece.value.upper() + best_move[2:] # type:ignore
49
 
50
+ return next_move_fen #type: ignore