code editor: Agent Studio improvement iteration 1 for invoice-guard-studio-v1. Goal
This commit is contained in:
15
agent.py
15
agent.py
@@ -21,7 +21,7 @@ from datetime import UTC, datetime
|
|||||||
from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
|
from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
|
||||||
from typing import Annotated, Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, ConfigDict, Field, ValidationError
|
||||||
|
|
||||||
import a2a_pack as a2a
|
import a2a_pack as a2a
|
||||||
from a2a_pack import (
|
from a2a_pack import (
|
||||||
@@ -43,6 +43,7 @@ from a2a_pack import (
|
|||||||
MAX_INVOICES = 50
|
MAX_INVOICES = 50
|
||||||
MAX_UPLOADS = 5
|
MAX_UPLOADS = 5
|
||||||
MAX_UPLOAD_BYTES = 256 * 1024
|
MAX_UPLOAD_BYTES = 256 * 1024
|
||||||
|
MAX_TEXT_FIELD_LENGTH = 180
|
||||||
ACCEPTED_MEDIA_TYPES = {"application/json", "text/json", "text/csv", "text/plain"}
|
ACCEPTED_MEDIA_TYPES = {"application/json", "text/json", "text/csv", "text/plain"}
|
||||||
DB_CONNECT_OPTIONS = "-c statement_timeout=5000 -c lock_timeout=3000 -c idle_in_transaction_session_timeout=10000"
|
DB_CONNECT_OPTIONS = "-c statement_timeout=5000 -c lock_timeout=3000 -c idle_in_transaction_session_timeout=10000"
|
||||||
|
|
||||||
@@ -57,6 +58,16 @@ class BrowserDocument(BaseModel):
|
|||||||
data_base64: str = Field(min_length=1, max_length=((MAX_UPLOAD_BYTES * 4) // 3) + 16)
|
data_base64: str = Field(min_length=1, max_length=((MAX_UPLOAD_BYTES * 4) // 3) + 16)
|
||||||
|
|
||||||
|
|
||||||
|
class InvoiceInput(BaseModel):
|
||||||
|
model_config = ConfigDict(extra="allow")
|
||||||
|
|
||||||
|
invoice_number: str = Field(min_length=1, max_length=120)
|
||||||
|
vendor: str = Field(min_length=1, max_length=MAX_TEXT_FIELD_LENGTH)
|
||||||
|
subtotal: Any
|
||||||
|
tax: Any
|
||||||
|
total: Any
|
||||||
|
|
||||||
|
|
||||||
class DecisionInput(BaseModel):
|
class DecisionInput(BaseModel):
|
||||||
decision_id: str = Field(min_length=1, max_length=120)
|
decision_id: str = Field(min_length=1, max_length=120)
|
||||||
invoice_number: str | None = Field(default=None, max_length=120)
|
invoice_number: str | None = Field(default=None, max_length=120)
|
||||||
@@ -70,7 +81,7 @@ class InvoiceGuardStudioV1(A2AAgent[InvoiceGuardStudioV1Config, PlatformUserAuth
|
|||||||
"One-page InvoiceGuard app for deterministic duplicate invoice number "
|
"One-page InvoiceGuard app for deterministic duplicate invoice number "
|
||||||
"and stated-total mismatch review with user-scoped Postgres persistence."
|
"and stated-total mismatch review with user-scoped Postgres persistence."
|
||||||
)
|
)
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
|
|
||||||
config_model = InvoiceGuardStudioV1Config
|
config_model = InvoiceGuardStudioV1Config
|
||||||
auth_model = PlatformUserAuth
|
auth_model = PlatformUserAuth
|
||||||
|
|||||||
Reference in New Issue
Block a user