haive.games.chess.api_example ============================= .. py:module:: haive.games.chess.api_example .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: haive.games.chess.api_example.CreateGameRequest haive.games.chess.api_example.GameResponse haive.games.chess.api_example.GameStateResponse haive.games.chess.api_example.LLMConfig haive.games.chess.api_example.MoveStreamEvent Functions --------- .. autoapisummary:: haive.games.chess.api_example.create_game haive.games.chess.api_example.delete_game haive.games.chess.api_example.get_game_state haive.games.chess.api_example.list_games haive.games.chess.api_example.list_providers haive.games.chess.api_example.root haive.games.chess.api_example.stream_game Module Contents --------------- .. py:class:: CreateGameRequest(/, **data) Bases: :py:obj:`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. .. py:class:: GameResponse(/, **data) Bases: :py:obj:`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. .. py:class:: GameStateResponse(/, **data) Bases: :py:obj:`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. .. py:class:: LLMConfig(/, **data) Bases: :py:obj:`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. .. py:class:: MoveStreamEvent(/, **data) Bases: :py:obj:`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. .. py:function:: create_game(request) :async: Create a new chess game. .. py:function:: delete_game(game_id) :async: Delete a game. .. py:function:: get_game_state(game_id) :async: Get the current state of a game. .. py:function:: list_games() :async: List all active games. .. py:function:: list_providers() :async: List available LLM providers. .. py:function:: root() :async: Root endpoint with API information. .. py:function:: stream_game(game_id, background_tasks) :async: Stream game execution events.