# # SPDX-FileCopyrightText: Hadad # SPDX-License-Identifier: Apache-2.0 # from pydantic import BaseModel # Import BaseModel from Pydantic to define data models with validation and serialization support from typing import Optional, Dict, List # Import Optional for optional fields, Dict for dictionary types, and List for list types class ResponseRequest(BaseModel): """ Data model representing the request body structure for the /v1/responses API endpoint. Attributes: - model: Optional string specifying the AI model to use; defaults to a predefined MODEL if omitted. - input: Required string containing the user's input text to send to the AI. - stream: Optional boolean indicating if the response should be streamed incrementally; defaults to False. - session_id: Optional string serving as a unique identifier for the user's session; if not provided, a new session is created. """ model: Optional[str] = None # AI model identifier, optional with default None input: str # User input text, required stream: Optional[bool] = False # Stream response flag, optional with default False session_id: Optional[str] = None # Session identifier, optional class OpenAIChatRequest(BaseModel): """ Data model defining the OpenAI-compatible request format for the /v1/chat/completions API endpoint. Attributes: - model: Optional string specifying the AI model to use; defaults to a predefined MODEL if omitted. - messages: List of message dictionaries, each containing 'role' and 'content' keys, representing the conversation history. - stream: Optional boolean indicating if the response should be streamed incrementally; defaults to False. - session_id: Optional string serving as a unique session identifier to maintain conversation context. """ model: Optional[str] = None # AI model identifier, optional with default None messages: List[Dict[str, str]] # List of chat messages with roles and content, required stream: Optional[bool] = False # Stream response flag, optional with default False session_id: Optional[str] = None # Session identifier, optional