games.chess.api_example¶
FastAPI example for chess game with configurable LLMs.
This module demonstrates how to create API endpoints for chess games with configurable LLM providers and models.
Classes¶
Request to create a new chess game. |
|
Response with game information. |
|
Response with current game state. |
|
LLM configuration for a player. |
|
Event streamed during game execution. |
Functions¶
|
Create a new chess game. |
|
Delete a game. |
|
Get the current state of a game. |
List all active games. |
|
List available LLM providers. |
|
|
Root endpoint with API information. |
|
Stream game execution events. |
Module Contents¶
- class games.chess.api_example.CreateGameRequest(/, **data)¶
Bases:
pydantic.BaseModel
Request to create a new chess game.
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.
- Parameters:
data (Any)
- class games.chess.api_example.GameResponse(/, **data)¶
Bases:
pydantic.BaseModel
Response with game information.
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.
- Parameters:
data (Any)
- class games.chess.api_example.GameStateResponse(/, **data)¶
Bases:
pydantic.BaseModel
Response with current game state.
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.
- Parameters:
data (Any)
- class games.chess.api_example.LLMConfig(/, **data)¶
Bases:
pydantic.BaseModel
LLM configuration for a player.
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.
- Parameters:
data (Any)
- class games.chess.api_example.MoveStreamEvent(/, **data)¶
Bases:
pydantic.BaseModel
Event streamed during game execution.
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.
- Parameters:
data (Any)
- async games.chess.api_example.create_game(request)¶
Create a new chess game.
- Parameters:
request (CreateGameRequest)
- async games.chess.api_example.get_game_state(game_id)¶
Get the current state of a game.
- Parameters:
game_id (str)
- async games.chess.api_example.list_games()¶
List all active games.
- async games.chess.api_example.list_providers()¶
List available LLM providers.
- async games.chess.api_example.root()¶
Root endpoint with API information.