chore: save local changes
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List, Dict
|
||||
from typing import Optional, List, Dict, Literal
|
||||
from enum import Enum
|
||||
|
||||
# Language type for prompts
|
||||
LanguageType = Literal["zh", "en"]
|
||||
|
||||
|
||||
class AttributeNode(BaseModel):
|
||||
name: str
|
||||
@@ -47,16 +50,19 @@ class CausalChain(BaseModel):
|
||||
|
||||
|
||||
class StreamAnalyzeRequest(BaseModel):
|
||||
"""多步驟分析請求(更新為支持動態類別)"""
|
||||
"""Multi-step analysis request (updated to support dynamic categories)"""
|
||||
query: str
|
||||
model: Optional[str] = None
|
||||
temperature: Optional[float] = 0.7
|
||||
chain_count: int = 5 # 用戶可設定要生成多少條因果鏈
|
||||
chain_count: int = 5 # User can set how many causal chains to generate
|
||||
|
||||
# 新增:動態類別支持
|
||||
category_mode: Optional[str] = "dynamic_auto" # CategoryMode enum 值
|
||||
# Dynamic category support
|
||||
category_mode: Optional[str] = "dynamic_auto" # CategoryMode enum value
|
||||
custom_categories: Optional[List[str]] = None
|
||||
suggested_category_count: int = 3 # 建議 LLM 生成的類別數量
|
||||
suggested_category_count: int = 3 # Suggest LLM to generate this many categories
|
||||
|
||||
# Language setting
|
||||
lang: LanguageType = "zh"
|
||||
|
||||
|
||||
class StreamAnalyzeResponse(BaseModel):
|
||||
@@ -136,13 +142,14 @@ class DAGRelationship(BaseModel):
|
||||
# ===== Transformation Agent schemas =====
|
||||
|
||||
class TransformationRequest(BaseModel):
|
||||
"""Transformation Agent 請求"""
|
||||
query: str # 原始查詢 (e.g., "腳踏車")
|
||||
category: str # 類別名稱 (e.g., "功能")
|
||||
attributes: List[str] # 該類別的屬性列表
|
||||
"""Transformation Agent request"""
|
||||
query: str # Original query (e.g., "bicycle")
|
||||
category: str # Category name (e.g., "Functions")
|
||||
attributes: List[str] # Attribute list for this category
|
||||
model: Optional[str] = None
|
||||
temperature: Optional[float] = 0.7
|
||||
keyword_count: int = 3 # 要生成的新關鍵字數量
|
||||
keyword_count: int = 3 # Number of new keywords to generate
|
||||
lang: LanguageType = "zh" # Language for prompts
|
||||
|
||||
|
||||
class TransformationDescription(BaseModel):
|
||||
@@ -215,24 +222,27 @@ class ExpertSource(str, Enum):
|
||||
|
||||
|
||||
class ExpertTransformationRequest(BaseModel):
|
||||
"""Expert Transformation Agent 請求"""
|
||||
"""Expert Transformation Agent request"""
|
||||
query: str
|
||||
category: str
|
||||
attributes: List[str]
|
||||
|
||||
# Expert parameters
|
||||
expert_count: int = 3 # 專家數量 (2-8)
|
||||
keywords_per_expert: int = 1 # 每個專家為每個屬性生成幾個關鍵字 (1-3)
|
||||
custom_experts: Optional[List[str]] = None # 用戶指定專家 ["藥師", "工程師"]
|
||||
expert_count: int = 3 # Number of experts (2-8)
|
||||
keywords_per_expert: int = 1 # Keywords per expert per attribute (1-3)
|
||||
custom_experts: Optional[List[str]] = None # User-specified experts
|
||||
|
||||
# Expert source parameters
|
||||
expert_source: ExpertSource = ExpertSource.LLM # 專家來源
|
||||
expert_language: str = "en" # 外部來源的語言 (目前只有英文資料)
|
||||
expert_source: ExpertSource = ExpertSource.LLM # Expert source
|
||||
expert_language: str = "en" # Language for external sources
|
||||
|
||||
# LLM parameters
|
||||
model: Optional[str] = None
|
||||
temperature: Optional[float] = 0.7
|
||||
|
||||
# Prompt language
|
||||
lang: LanguageType = "zh"
|
||||
|
||||
|
||||
# ===== Deduplication Agent schemas =====
|
||||
|
||||
@@ -243,11 +253,12 @@ class DeduplicationMethod(str, Enum):
|
||||
|
||||
|
||||
class DeduplicationRequest(BaseModel):
|
||||
"""去重請求"""
|
||||
"""Deduplication request"""
|
||||
descriptions: List[ExpertTransformationDescription]
|
||||
method: DeduplicationMethod = DeduplicationMethod.EMBEDDING # 去重方法
|
||||
similarity_threshold: float = 0.85 # 餘弦相似度閾值 (0.0-1.0),僅 Embedding 使用
|
||||
model: Optional[str] = None # Embedding/LLM 模型
|
||||
method: DeduplicationMethod = DeduplicationMethod.EMBEDDING # Deduplication method
|
||||
similarity_threshold: float = 0.85 # Cosine similarity threshold (0.0-1.0), only for Embedding
|
||||
model: Optional[str] = None # Embedding/LLM model
|
||||
lang: LanguageType = "zh" # Prompt language (for LLM method)
|
||||
|
||||
|
||||
class DescriptionGroup(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user