This commit is contained in:
2025-08-13 23:30:22 +02:00
parent 87ba009bd7
commit 02290bb935
4 changed files with 13 additions and 11 deletions

View File

@@ -32,11 +32,14 @@ class LineItem(BaseModel):
class InvoiceInfo(BaseModel):
"""Defines the detailed, structured information to be extracted from an invoice."""
date: Optional[str] = Field("", description="Extract in YYYY-MM-DD format. If unclear, leave as an empty string.")
invoice_date: Optional[str] = Field("", description="The invoice date. Extract in YYYY-MM-DD format. If unclear, leave as an empty string.")
invoice_due_date: Optional[str] = Field("", description="The invoice due date.Extract in YYYY-MM-DD format. If unclear, leave as an empty string.")
invoice_number: Optional[str] = Field("", description="If not found or unclear, leave as an empty string.")
ocr_number: Optional[str] = Field("", description="The OCR number from the invoice. If not found or unclear, leave as an empty string.")
supplier_number: Optional[str] = Field("", description="It's the organisation number. If not found or unclear, leave as an empty string.")
biller_name: Optional[str] = Field("", description="It's the sender's name. If not found or unclear, leave as an empty string.")
amount: Optional[float] = Field(None, description="Extract and format to decimal. If not present, leave as null.")
tax_exclusive_amount: Optional[float] = Field(None, description="Extract the the amount excluding taxes and format it to a decimal number. If not present, leave as null.")
customer_name: Optional[str] = Field("", description="It's the receiver's name. Clean any special chars from the name. If not found or unclear, leave as an empty string.")
customer_address: Optional[str] = Field("", description="It's the receiver's address. Put it in one line. If not found or unclear, leave as an empty string.")
customer_address_line: Optional[str] = Field("", description="It's the receiver's address line, not the whole address. If not found or unclear, leave as an empty string.")
@@ -50,4 +53,4 @@ class InvoiceInfo(BaseModel):
bank_giro: Optional[str] = Field("", description="BankGiro number, e.g., '123-4567'. If not found, leave as an empty string.")
plus_giro: Optional[str] = Field("", description="PlusGiro number, e.g., '123456-7'. If not found, leave as an empty string.")
customer_ssn: Optional[str] = Field("", description="Customer's social security number, e.g., 'YYYYMMDD-XXXX'. If not found, leave as an empty string.")
line_items: List[LineItem] = Field([], description="A list of all line items from the invoice.")
line_items: List[LineItem] = Field([], description="A list of all line items from the invoice. Make sure all of them are extracted.")