"""
检索日志 Schema
"""
from typing import Optional, List, Dict, Any
from datetime import datetime

from pydantic import BaseModel, Field, ConfigDict

from app.base_schema import CSTDatetime


class RetrievalLogResponse(BaseModel):
    """检索日志输出"""
    id: str
    query: str
    knowledge_base_ids: List[str] = []
    retrieval_mode: str = "hybrid"
    top_k: int = 5
    score_threshold: float = 0.5
    result_count: int = 0
    results: Optional[List[Dict[str, Any]]] = None
    rerank_applied: str = "false"
    elapsed_time: int = 0
    source: Optional[str] = None
    user_id: Optional[str] = None
    sys_create_datetime: Optional[CSTDatetime] = None

    model_config = ConfigDict(from_attributes=True)
