File size: 803 Bytes
027123c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
767625e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Structured output models for LLM."""

from pydantic import BaseModel, Field


class IntentClassification(BaseModel):
    """Intent classification output."""
    intent: str = Field(
        description="The user's intent: 'question', 'greeting', 'goodbye', 'other'"
    )
    needs_search: bool = Field(
        description="Whether document search is needed"
    )
    search_query: str = Field(
        default="",
        description="The query to use for document search if needed"
    )
    direct_response: str = Field(
        default="",
        description="Direct response if no search needed (for greetings, etc.)"
    )
    source_hint: str = Field(
        default="both",
        description="Which sources to search: 'document' (PDF/DOCX/TXT), 'schema' (DB/CSV/XLSX), or 'both'"
    )