|
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel |
|
from typing import Optional, Dict, List |
|
|
|
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 |
|
input: str |
|
stream: Optional[bool] = False |
|
session_id: Optional[str] = None |
|
|
|
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 |
|
messages: List[Dict[str, str]] |
|
stream: Optional[bool] = False |
|
session_id: Optional[str] = None |
|
|