geometor.arcprize.solvers.gemini_solver
Dialogue-Based ARC Puzzle Solver
Implements a structured workflow for solving ARC puzzles through conversation with LLMs, focusing on building understanding before attempting solutions.
The solver follows a systematic process:
Examine training examples individually
Build comprehensive observations
Validate understanding through pre-testing
Implement solution through standard operations
Key Features:
Progressive observation building
Code-validated pattern discovery
Natural language program development
Iterative refinement through dialogue
Comprehensive session logging
The solver maintains a conversation history and working grid state, allowing for cumulative understanding and step-by-step solution development.
- class geometor.arcprize.solvers.gemini_solver.PuzzleSolver(puzzle: Puzzle, model_name: str = 'models/gemini-1.5-flash-002', instructions_file: str = 'gemini_instructions.md', output_dir: str = '.', max_iterations: int = 5, timestamp: str | None = None, client: GeminiClient | None = None, logger: Logger | None = None)[source]
Bases:
object
Initialize the PuzzleSolver with all necessary components for solving and logging.
parameters
- puzzle
Puzzle
object containing all the elements of the Puzzle
- model_name
str
name of the Gemini model
- instructions_filestr
path to file with system instructions
- output_diroptional str
default ‘.’
- max_iterationsint
max loops in the test phase
- timestampoptional
str
in the format %y.%j.%H%M%S
- clientoptional
GeminiClient
pass in client with previous context
- loggeroptional
Logger
pass in previous logger
attributes
start_time : datetime
working_grid :
Grid
- solve()[source]
Main method to orchestrate the puzzle solving workflow. Returns the working grid if solution is found, None otherwise.
- initialize_output_from_input() str [source]
Initialize the test output grid with a copy of the input grid.
- initialize_output_by_size(width: int, height: int, color: int = 0) str [source]
Initialize the test output grid with specific dimensions.
- puzzle
- exception geometor.arcprize.solvers.gemini_solver.MultipleFunctionCallsError[source]
Bases:
Exception
Raised when multiple function calls are detected in a single response.
- exception geometor.arcprize.solvers.gemini_solver.MaxRetriesExceededError[source]
Bases:
Exception
Raised when maximum retry attempts are exhausted.
- exception geometor.arcprize.solvers.gemini_solver.UnknownFunctionError[source]
Bases:
Exception
Raised when an unknown function is called.