legco_ai_assistant/backend/app/models/decompose.py

16 lines
730 B
Python

from pydantic import BaseModel, Field
class SubQuestions(BaseModel):
"""Structured output model for query decomposition.
Used with LangChain's with_structured_output() to guarantee
the LLM returns a valid list of sub-questions.
"""
questions: list[str] = Field(
description="請將問題/任務拆解成 1-3 個簡化子問題,標籤式主題必須清楚、簡潔、具體,一看就明白(建議 3-8 個字),若涉及地點、地區、人物、時間、金額/財政 等關鍵資訊,必須包含在標籤中 。具體提問/要求要精準、完整 並全部轉換成以下固定格式:\n「標籤式主題:具體提問/要求」",
min_length=1,
max_length=3,
)