33 lines
651 B
Python
33 lines
651 B
Python
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class MatchRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
messages: list[str]
|
|
|
|
|
|
class Candidate(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
sku: str
|
|
confidence: float = Field(ge=0.0, le=1.0)
|
|
|
|
|
|
class MatchResult(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
message: str
|
|
status: Literal["matched", "ambiguous", "not_found"]
|
|
candidates: list[Candidate]
|
|
|
|
|
|
class MatchResponse(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
results: list[MatchResult]
|