All checks were successful
continuous-integration/drone/push Build is passing
* Delete legacy from bot * Clear old models * Единый http клиент * РАГ полечен
29 lines
498 B
Python
29 lines
498 B
Python
"""
|
|
Схемы для RAG
|
|
"""
|
|
from uuid import UUID
|
|
from pydantic import BaseModel, Field
|
|
from typing import List, Any
|
|
|
|
|
|
class QuestionRequest(BaseModel):
|
|
conversation_id: UUID
|
|
question: str = Field(..., min_length=3)
|
|
top_k: int = 20
|
|
rerank_top_n: int = 5
|
|
|
|
|
|
class RAGSource(BaseModel):
|
|
index: int
|
|
document_id: str
|
|
chunk_id: str
|
|
title: str | None = None
|
|
|
|
|
|
class RAGAnswer(BaseModel):
|
|
answer: str
|
|
sources: List[RAGSource] = []
|
|
usage: dict[str, Any] = {}
|
|
|
|
|