SanjinDedic / agent_games

Secure, extensible agent competition platform API build with FastAPI, SQLmodel, Pydantic and Docker
9 stars 2 forks source link

Feedback filtering #98

Open SanjinDedic opened 4 days ago

SanjinDedic commented 4 days ago

This will be performed by ALL the games returning a JSON object for feedback instead of a strong

def run_single_game_with_feedback(cls, league, custom_rewards=None):
    game = cls(league, verbose=True)
    results = game.play_game(custom_rewards)
    game_feedback = "\n".join(game.game_feedback)
    player_feedback = "\n".join(game.player_feedback)
    return {
        "results": results,
        "feedback": game_feedback, #CONVERT FROM MD FORMATTED STRONG TO JSON OBJ
        "player_feedback": player_feedback #CONVERT FROM MD FORMATTED STRONG TO JSON OBJ
    }

player_feedback and game_feedback are basically the same but the player feedback includes stuff that the player printed by using self.add_feedback.

Thse files will need to be updated: backend/docker_simulation.py has a validation JSON schema that will also need to be changed existing games: greedy_pig and prisoners_dilemma will need to be changed to return JSON frontend/src/AgentGames/Utilities/MarkdownFeedback.jsx will need to be replaced with something that prints formatted json

Specific games could then have their own react component to display the results

Once this is implemented we will no longer need docker_results.json. The feedback can be saved to the DB using https://sqlite.org/jsonb.html