games.chess.modelsΒΆ
Chess game models module.
- This module provides data models for the chess game, including:
Move representation
Player decisions
Position analysis
Structured output models for LLMs
ClassesΒΆ
Model for chess position analysis. |
|
Model for chess moves with validation. |
|
Model for chess move validation results. |
|
Model for chess player decisions. |
|
Structured analysis of a chess position in segments. |
Module ContentsΒΆ
- class games.chess.models.ChessAnalysis(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Model for chess position analysis.
- This class represents a detailed analysis of a chess position:
Material evaluation
Positional assessment
Tactical opportunities
Strategic plans
- Parameters:
data (Any)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class games.chess.models.ChessMoveModel(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Model for chess moves with validation.
- This class represents a chess move with:
UCI notation (e.g., βe2e4β)
Optional explanation
Move validation
- Parameters:
data (Any)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_move(move, explanation=None)ΒΆ
Create from a chess.Move object.
- Parameters:
move (chess.Move)
explanation (str | None)
- Return type:
- to_move()ΒΆ
Convert to a chess.Move object.
- Return type:
chess.Move
- classmethod validate_move(v)ΒΆ
Validate the move format.
- Parameters:
v (str) β The move string to validate
- Returns:
The validated move string
- Raises:
ValueError β If move is not a string or too short
- Return type:
- class games.chess.models.ChessMoveValidation(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Model for chess move validation results.
- This class represents the validation of a chess move:
Move legality
Error messages
Resulting position
- Parameters:
data (Any)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class games.chess.models.ChessPlayerDecision(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Model for chess player decisions.
- This class represents a playerβs decision-making process:
Move selection
Position evaluation
Alternative moves considered
Reasoning process
- Parameters:
data (Any)
- selected_moveΒΆ
Chosen move with explanation
- Type:
- alternativesΒΆ
Alternative moves considered
- Type:
List[ChessMoveModel]
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class games.chess.models.SegmentedAnalysis(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Structured analysis of a chess position in segments.
- This class breaks down position analysis into distinct categories:
Numerical position score
Attacking chances
Defensive needs
Strategic plans
- Parameters:
data (Any)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.