Spaces:
Running
Running
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -10,7 +10,7 @@ from poke_env.player import Player
|
|
| 10 |
from poke_env.environment.battle import Battle
|
| 11 |
from poke_env.environment.move import Move
|
| 12 |
from poke_env.environment.pokemon import Pokemon
|
| 13 |
-
|
| 14 |
|
| 15 |
class OpenAIAgent(Player):
|
| 16 |
"""
|
|
@@ -33,36 +33,7 @@ class OpenAIAgent(Player):
|
|
| 33 |
self.model = "gpt-4o" # Or "gpt-3.5-turbo", "gpt-4-turbo-preview", etc.
|
| 34 |
|
| 35 |
# Define the functions OpenAI can "call"
|
| 36 |
-
self.functions =
|
| 37 |
-
{
|
| 38 |
-
"name": "choose_move",
|
| 39 |
-
"description": "Selects and executes an available attacking or status move.",
|
| 40 |
-
"parameters": {
|
| 41 |
-
"type": "object",
|
| 42 |
-
"properties": {
|
| 43 |
-
"move_name": {
|
| 44 |
-
"type": "string",
|
| 45 |
-
"description": "The exact name of the move to use (e.g., 'Thunderbolt', 'Swords Dance'). Must be one of the available moves.",
|
| 46 |
-
},
|
| 47 |
-
},
|
| 48 |
-
"required": ["move_name"],
|
| 49 |
-
},
|
| 50 |
-
},
|
| 51 |
-
{
|
| 52 |
-
"name": "choose_switch",
|
| 53 |
-
"description": "Selects an available Pokémon from the bench to switch into.",
|
| 54 |
-
"parameters": {
|
| 55 |
-
"type": "object",
|
| 56 |
-
"properties": {
|
| 57 |
-
"pokemon_name": {
|
| 58 |
-
"type": "string",
|
| 59 |
-
"description": "The exact name of the Pokémon species to switch to (e.g., 'Pikachu', 'Charizard'). Must be one of the available switches.",
|
| 60 |
-
},
|
| 61 |
-
},
|
| 62 |
-
"required": ["pokemon_name"],
|
| 63 |
-
},
|
| 64 |
-
},
|
| 65 |
-
]
|
| 66 |
self.battle_history = [] # Optional: To potentially add context later
|
| 67 |
|
| 68 |
def _format_battle_state(self, battle: Battle) -> str:
|
|
|
|
| 10 |
from poke_env.environment.battle import Battle
|
| 11 |
from poke_env.environment.move import Move
|
| 12 |
from poke_env.environment.pokemon import Pokemon
|
| 13 |
+
from tools import toolsList
|
| 14 |
|
| 15 |
class OpenAIAgent(Player):
|
| 16 |
"""
|
|
|
|
| 33 |
self.model = "gpt-4o" # Or "gpt-3.5-turbo", "gpt-4-turbo-preview", etc.
|
| 34 |
|
| 35 |
# Define the functions OpenAI can "call"
|
| 36 |
+
self.functions = toolsList
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
self.battle_history = [] # Optional: To potentially add context later
|
| 38 |
|
| 39 |
def _format_battle_state(self, battle: Battle) -> str:
|