init
This commit is contained in:
92
models/debate.py
Normal file
92
models/debate.py
Normal file
@@ -0,0 +1,92 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from enum import Enum
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class ModelProvider(str, Enum):
|
||||
OPENAI = "openai"
|
||||
DEEPSEEK = "deepseek"
|
||||
QWEN = "qwen"
|
||||
CLAUDE = "claude"
|
||||
|
||||
|
||||
class DebateStance(str, Enum):
|
||||
PRO = "pro"
|
||||
CON = "con"
|
||||
|
||||
|
||||
class SearchResult(BaseModel):
|
||||
title: str
|
||||
url: str
|
||||
snippet: str
|
||||
score: Optional[float] = None
|
||||
|
||||
|
||||
class SearchEvidence(BaseModel):
|
||||
query: str
|
||||
results: List[SearchResult]
|
||||
mode: str # "auto", "tool", "both"
|
||||
|
||||
|
||||
class DebateRound(BaseModel):
|
||||
round_number: int
|
||||
speaker: str # Model identifier
|
||||
stance: DebateStance
|
||||
content: str
|
||||
timestamp: datetime
|
||||
token_count: Optional[int] = None
|
||||
search_evidence: Optional[SearchEvidence] = None
|
||||
|
||||
|
||||
class DebateParticipant(BaseModel):
|
||||
model_config = {"protected_namespaces": ()}
|
||||
|
||||
model_identifier: str
|
||||
provider: ModelProvider
|
||||
stance: DebateStance
|
||||
api_key: Optional[str] = None
|
||||
|
||||
|
||||
class DebateConstraints(BaseModel):
|
||||
max_rounds: int = 5
|
||||
max_tokens_per_turn: int = 500
|
||||
max_total_tokens: Optional[int] = None
|
||||
forbid_repetition: bool = True
|
||||
must_respond_to_opponent: bool = True
|
||||
web_search_enabled: bool = False
|
||||
web_search_mode: str = "auto" # "auto", "tool", "both"
|
||||
|
||||
|
||||
class DebateRequest(BaseModel):
|
||||
topic: str
|
||||
participants: List[DebateParticipant]
|
||||
constraints: DebateConstraints
|
||||
custom_system_prompt: Optional[str] = None
|
||||
|
||||
|
||||
class EvidenceReference(BaseModel):
|
||||
round_number: int
|
||||
speaker: str
|
||||
stance: DebateStance
|
||||
|
||||
|
||||
class EvidenceEntry(BaseModel):
|
||||
title: str
|
||||
url: str
|
||||
snippet: str
|
||||
score: Optional[float] = None
|
||||
references: List[EvidenceReference]
|
||||
|
||||
|
||||
class DebateSession(BaseModel):
|
||||
session_id: str
|
||||
topic: str
|
||||
participants: List[DebateParticipant]
|
||||
constraints: DebateConstraints
|
||||
rounds: List[DebateRound]
|
||||
status: str # "active", "completed", "terminated"
|
||||
created_at: datetime
|
||||
completed_at: Optional[datetime] = None
|
||||
summary: Optional[str] = None
|
||||
evidence_library: List[EvidenceEntry] = []
|
||||
Reference in New Issue
Block a user